From 436bca692ccf1473ab7c3420abbeabcee88b0f7a Mon Sep 17 00:00:00 2001 From: Wenqi Li <831580+wyli@users.noreply.github.com> Date: Fri, 28 Jul 2023 18:42:19 +0100 Subject: [PATCH] backward compatibility for RandAffined --- monai/transforms/spatial/dictionary.py | 1 + 1 file changed, 1 insertion(+) diff --git a/monai/transforms/spatial/dictionary.py b/monai/transforms/spatial/dictionary.py index 79742f0582..6f53b10fc2 100644 --- a/monai/transforms/spatial/dictionary.py +++ b/monai/transforms/spatial/dictionary.py @@ -1141,6 +1141,7 @@ def __call__( grid = self.rand_affine.get_identity_grid(sp_size, lazy=lazy_) if self._do_transform: # add some random factors grid = self.rand_affine.rand_affine_grid(sp_size, grid=grid, lazy=lazy_) + grid = 0 if grid is None else grid # always provide a grid to self.rand_affine for key, mode, padding_mode in self.key_iterator(d, self.mode, self.padding_mode): # do the transform