(initial_value, final_value, total_steps, current_step)
| 157 | |
| 158 | |
| 159 | def linear_decay(initial_value, final_value, total_steps, current_step): |
| 160 | if current_step >= total_steps: |
| 161 | return final_value |
| 162 | current_step = max(0, current_step) |
| 163 | step_size = (final_value - initial_value) / total_steps |
| 164 | current_value = initial_value + step_size * current_step |
| 165 | return current_value |
| 166 | |
| 167 | |
| 168 | def generate_timestep_with_lognorm(low, high, shape, device="cpu", generator=None): |