Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion monai/transforms/croppad/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def __call__(
# all zeros, skip padding
return img

padder = Pad(all_pad_width, mode or self.mode, **self.kwargs)
padder = Pad(to_pad=all_pad_width, mode=mode or self.mode, **self.kwargs)
return padder(img)


Expand Down
10 changes: 5 additions & 5 deletions monai/transforms/spatial/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ def __call__(
keep_size=self.keep_size,
mode=look_up_option(mode or self.mode, InterpolateMode),
padding_mode=padding_mode or self.padding_mode,
align_corners=align_corners or self.align_corners,
align_corners=self.align_corners if align_corners is None else align_corners,
**self.kwargs,
)(img)

Expand Down Expand Up @@ -1796,7 +1796,7 @@ def __call__(
Padding mode for outside grid values. Defaults to ``self.padding_mode``.
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
"""
sp_size = fall_back_tuple(spatial_size or self.spatial_size, img.shape[1:])
sp_size = fall_back_tuple(self.spatial_size if spatial_size is None else spatial_size, img.shape[1:])
grid, affine = self.affine_grid(spatial_size=sp_size)
ret = self.resampler(img, grid=grid, mode=mode or self.mode, padding_mode=padding_mode or self.padding_mode)

Expand Down Expand Up @@ -1978,7 +1978,7 @@ def __call__(

# if not doing transform and spatial size doesn't change, nothing to do
# except convert to float and device
sp_size = fall_back_tuple(spatial_size or self.spatial_size, img.shape[1:])
sp_size = fall_back_tuple(self.spatial_size if spatial_size is None else spatial_size, img.shape[1:])
do_resampling = self._do_transform or (sp_size != ensure_tuple(img.shape[1:]))
if not do_resampling:
img, *_ = convert_data_type(img, dtype=torch.float32, device=self.resampler.device)
Expand Down Expand Up @@ -2120,7 +2120,7 @@ def __call__(
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
randomize: whether to execute `randomize()` function first, default to True.
"""
sp_size = fall_back_tuple(spatial_size or self.spatial_size, img.shape[1:])
sp_size = fall_back_tuple(self.spatial_size if spatial_size is None else spatial_size, img.shape[1:])
if randomize:
self.randomize(spatial_size=sp_size)

Expand Down Expand Up @@ -2280,7 +2280,7 @@ def __call__(
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
randomize: whether to execute `randomize()` function first, default to True.
"""
sp_size = fall_back_tuple(spatial_size or self.spatial_size, img.shape[1:])
sp_size = fall_back_tuple(self.spatial_size if spatial_size is None else spatial_size, img.shape[1:])
if randomize:
self.randomize(grid_size=sp_size)

Expand Down