Skip to content

Commit

Permalink
generate grid when grid is None
Browse files Browse the repository at this point in the history
  • Loading branch information
wyli authored Jul 28, 2023
1 parent 70d7828 commit d452bd1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion monai/transforms/spatial/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2523,7 +2523,8 @@ def __call__(
img = convert_to_tensor(img, track_meta=get_track_meta())
if lazy_:
if self._do_transform:
self.rand_affine_grid(sp_size, randomize=randomize, lazy=True)
if grid is None:
self.rand_affine_grid(sp_size, randomize=randomize, lazy=True)
affine = self.rand_affine_grid.get_transformation_matrix()
else:
affine = convert_to_dst_type(torch.eye(len(sp_size) + 1), img, dtype=self.rand_affine_grid.dtype)[0]
Expand Down

0 comments on commit d452bd1

Please sign in to comment.