Repository: Project-MONAI/MONAI

Issue:
compatibility test with torch 1.11
**Is your feature request related to a problem? Please describe.**
evaluate all the test cases with torch 1.11 
compatibility test with torch 1.11
**Is your feature request related to a problem? Please describe.**
evaluate all the test cases with torch 1.11 


Discussion:

Resolving patch:
diff --git a/monai/apps/pathology/transforms/spatial/array.py b/monai/apps/pathology/transforms/spatial/array.py
--- a/monai/apps/pathology/transforms/spatial/array.py
+++ b/monai/apps/pathology/transforms/spatial/array.py
@@ -203,7 +203,7 @@ def __call__(self, image: NdarrayOrTensor) -> NdarrayOrTensor:
             c, h, w = img_np.shape
             pad_h = (self.tile_size - h % self.tile_size) % self.tile_size
             pad_w = (self.tile_size - w % self.tile_size) % self.tile_size
-            img_np = np.pad(
+            img_np = np.pad(  # type: ignore
                 img_np,
                 [[0, 0], [pad_h // 2, pad_h - pad_h // 2], [pad_w // 2, pad_w - pad_w // 2]],
                 constant_values=self.background_val,
@@ -220,7 +220,7 @@ def __call__(self, image: NdarrayOrTensor) -> NdarrayOrTensor:
             strides=(x_stride * x_step, y_stride * y_step, c_stride, x_stride, y_stride),
             writeable=False,
         )
-        img_np = llw.reshape(-1, c_image, h_tile, w_tile)
+        img_np = llw.reshape(-1, c_image, h_tile, w_tile)  # type: ignore
 
         # if keeping all patches
         if self.tile_count is None:
@@ -251,7 +251,7 @@ def __call__(self, image: NdarrayOrTensor) -> NdarrayOrTensor:
                         img_np = img_np[self.random_idxs]
 
             elif len(img_np) < self.tile_count:
-                img_np = np.pad(
+                img_np = np.pad(  # type: ignore
                     img_np,
                     [[0, self.tile_count - len(img_np)], [0, 0], [0, 0], [0, 0]],
                     constant_values=self.background_val,
diff --git a/monai/transforms/intensity/array.py b/monai/transforms/intensity/array.py
--- a/monai/transforms/intensity/array.py
+++ b/monai/transforms/intensity/array.py
@@ -1405,7 +1405,7 @@ def __call__(self, img: NdarrayOrTensor, randomize: bool = True) -> NdarrayOrTen
         img_min, img_max = img_np.min(), img_np.max()
         reference_control_points_scaled = self.reference_control_points * (img_max - img_min) + img_min
         floating_control_points_scaled = self.floating_control_points * (img_max - img_min) + img_min
-        img_np = np.asarray(
+        img_np = np.asarray(  # type: ignore
             np.interp(img_np, reference_control_points_scaled, floating_control_points_scaled), dtype=img_np.dtype
         )
         img, *_ = convert_to_dst_type(img_np, dst=img)
diff --git a/monai/visualize/utils.py b/monai/visualize/utils.py
--- a/monai/visualize/utils.py
+++ b/monai/visualize/utils.py
@@ -107,7 +107,7 @@ def matshow3d(
         vol = np.concatenate([pad(v) for v in vol], axis=0)
     else:  # ndarray
         while len(vol.shape) < 3:
-            vol = np.expand_dims(vol, 0)  # so that we display 2d as well
+            vol = np.expand_dims(vol, 0)  # type: ignore  # so that we display 2d as well
 
     if channel_dim is not None:  # move the expected dim to construct frames with `B` dim
         vol = np.moveaxis(vol, frame_dim, -4)  # type: ignore


Test patch: