Skip to content

Commit 616f5f2

Browse files
authored
Refactor timesteps calculation in ddim.py
Signed-off-by: ytl0623 <[email protected]>
1 parent aa3cce6 commit 616f5f2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

monai/networks/schedulers/ddim.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ def set_timesteps(self, num_inference_steps: int, device: str | torch.device | N
125125
f" the max train timestep."
126126
)
127127

128-
# creates integer timesteps by multiplying by ratio
129-
# casting to int to avoid issues when num_inference_step is power of 3
130-
timesteps = np.linspace(num_train_timesteps - 1 - steps_offset, 0, num_inference_steps).round().astype(np.int64)
128+
timesteps = np.linspace((self.num_train_timesteps - 1) - self.steps_offset, 0, num_inference_steps).round().astype(np.int64)
131129
self.timesteps = torch.from_numpy(timesteps).to(device)
132130
self.timesteps += self.steps_offset
133131

0 commit comments

Comments
 (0)