Skip to content

Commit

Permalink
Update simulation.py for autograd (#11)
Browse files Browse the repository at this point in the history
Inplace operation /= and *= break autograd
  • Loading branch information
YohannPerron authored Aug 17, 2023
1 parent c07863a commit 82dfb08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions waveprop/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def propagate(self, obj, return_object_plane=False):
image_plane = add_shot_noise(image_plane, snr_db=self.snr_db)

# 5) Quantize as on sensor
image_plane /= image_plane.max()
image_plane *= self.max_val
image_plane = image_plane / image_plane.max()
image_plane = image_plane * self.max_val
if torch.is_tensor(image_plane):
image_plane = image_plane.to(self.output_dtype)
else:
Expand Down

0 comments on commit 82dfb08

Please sign in to comment.