Singlestep DPM-Solver with the order `order` from time `s` to time `t`. Args: x: A pytorch tensor. The initial value at time `s`. s: A pytorch tensor. The starting time, with the shape (1,). t: A pytorch tensor. The ending time, with the shape (1
(self, x, s, t, order, return_intermediate=False, solver_type='dpmsolver', r1=None, r2=None)
| 912 | return x_t |
| 913 | |
| 914 | def singlestep_dpm_solver_update(self, x, s, t, order, return_intermediate=False, solver_type='dpmsolver', r1=None, r2=None): |
| 915 | """ |
| 916 | Singlestep DPM-Solver with the order `order` from time `s` to time `t`. |
| 917 | |
| 918 | Args: |
| 919 | x: A pytorch tensor. The initial value at time `s`. |
| 920 | s: A pytorch tensor. The starting time, with the shape (1,). |
| 921 | t: A pytorch tensor. The ending time, with the shape (1,). |
| 922 | order: A `int`. The order of DPM-Solver. We only support order == 1 or 2 or 3. |
| 923 | return_intermediate: A `bool`. If true, also return the model value at time `s`, `s1` and `s2` (the intermediate times). |
| 924 | solver_type: either 'dpmsolver' or 'taylor'. The type for the high-order solvers. |
| 925 | The type slightly impacts the performance. We recommend to use 'dpmsolver' type. |
| 926 | r1: A `float`. The hyperparameter of the second-order or third-order solver. |
| 927 | r2: A `float`. The hyperparameter of the third-order solver. |
| 928 | Returns: |
| 929 | x_t: A pytorch tensor. The approximated solution at time `t`. |
| 930 | """ |
| 931 | if order == 1: |
| 932 | return self.dpm_solver_first_update(x, s, t, return_intermediate=return_intermediate) |
| 933 | elif order == 2: |
| 934 | return self.singlestep_dpm_solver_second_update(x, s, t, return_intermediate=return_intermediate, solver_type=solver_type, r1=r1) |
| 935 | elif order == 3: |
| 936 | return self.singlestep_dpm_solver_third_update(x, s, t, return_intermediate=return_intermediate, solver_type=solver_type, r1=r1, r2=r2) |
| 937 | else: |
| 938 | raise ValueError("Solver order must be 1 or 2 or 3, got {}".format(order)) |
| 939 | |
| 940 | def multistep_dpm_solver_update(self, x, model_prev_list, t_prev_list, t, order, solver_type='dpmsolver'): |
| 941 | """ |
no test coverage detected