File tree Expand file tree Collapse file tree
cake-core/src/models/luxtts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,22 +43,13 @@ impl EulerSolver {
4343 v : & Tensor ,
4444 t_cur : f32 ,
4545 t_next : f32 ,
46- is_last : bool ,
46+ _is_last : bool ,
4747 ) -> Result < Tensor > {
48- // x_1_pred = x + (1 - t_cur) * v
49- let x_1_pred = ( x + ( v * ( 1.0 - t_cur) as f64 ) ?) ?;
50-
51- if is_last {
52- // Last step: return x_1_pred directly
53- return Ok ( x_1_pred) ;
54- }
55-
56- // x_0_pred = x - t_cur * v
57- let x_0_pred = ( x - ( v * t_cur as f64 ) ?) ?;
58-
59- // x_next = (1 - t_next) * x_0_pred + t_next * x_1_pred
60- let result = ( ( & x_0_pred * ( 1.0 - t_next) as f64 ) ? + ( & x_1_pred * t_next as f64 ) ?) ?;
61- Ok ( result)
48+ // Simplified: x_next = x + (t_next - t_cur) * v
49+ // (algebraically equivalent to the x_0_pred/x_1_pred formulation)
50+ // Last step (t_next=1.0): x + (1 - t_cur) * v = x_1_pred
51+ let dt = ( t_next - t_cur) as f64 ;
52+ Ok ( ( x + ( v * dt) ?) ?)
6253 }
6354}
6455
You can’t perform that action at this time.
0 commit comments