From 8a52c1c01c3098e64ac54272008da1b627008480 Mon Sep 17 00:00:00 2001 From: John Zielke Date: Fri, 14 Nov 2025 16:40:19 -0500 Subject: [PATCH] Fix index using tuple for image cropping operation I'm getting a warning at this line: "Using a non-tuple sequence for multidimensional indexing is deprecated and will be changed in pytorch 2.9; use x instead of x. In pytorch 2.9 this will be interpreted as _tensor.py:1654 tensor index, x, which will result either in an error or a different result". Signed-off-by: John Zielke --- monai/transforms/croppad/functional.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/transforms/croppad/functional.py b/monai/transforms/croppad/functional.py index 361ec48dcd..653db43bc5 100644 --- a/monai/transforms/croppad/functional.py +++ b/monai/transforms/croppad/functional.py @@ -144,7 +144,7 @@ def crop_or_pad_nd(img: torch.Tensor, translation_mat, spatial_size: tuple[int, _mode = _convert_pt_pad_mode(mode) img = pad_nd(img, to_pad, mode=_mode, **kwargs) if do_crop: - img = img[to_crop] + img = img[tuple(to_crop)] return img