diff --git a/monai/transforms/spatial/array.py b/monai/transforms/spatial/array.py index 654f408cb0..6d95acb3d1 100644 --- a/monai/transforms/spatial/array.py +++ b/monai/transforms/spatial/array.py @@ -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]