Changing while to for for more readibility

This commit is contained in:
Shivam Mehta
2023-12-05 12:10:52 +00:00
parent 6e71dc8b8f
commit f39ee6cf3b

View File

@@ -73,16 +73,14 @@ class BASECFM(torch.nn.Module, ABC):
# Or in future might add like a return_all_steps flag # Or in future might add like a return_all_steps flag
sol = [] sol = []
steps = 1 for step in range(1, len(t_span)):
while steps <= len(t_span) - 1:
dphi_dt = self.estimator(x, mask, mu, t, spks, cond) dphi_dt = self.estimator(x, mask, mu, t, spks, cond)
x = x + dt * dphi_dt x = x + dt * dphi_dt
t = t + dt t = t + dt
sol.append(x) sol.append(x)
if steps < len(t_span) - 1: if step < len(t_span) - 1:
dt = t_span[steps + 1] - t dt = t_span[step + 1] - t
steps += 1
return sol[-1] return sol[-1]