docstr: resize 'spatial_size' and 'mode'
docstr_tok: ["resize","'spatial_size","'","and","'mode","'"]
code: def test_correct_results(self, spatial_size, mode, anti_aliasing):
      """resize 'spatial_size' and 'mode'"""
      init_param = {
          "spatial_size": spatial_size,
          "mode": mode,
          "anti_aliasing": anti_aliasing,
          "dtype": np.float64,
      }
      resize = Resize(**init_param)
      _order = 0
      if mode.endswith("linear"):
          _order = 1
      if spatial_size == (32, -1):
          spatial_size = (32, 64)
  
      expected = [
          skimage.transform.resize(
              channel,
              spatial_size,
              order=_order,
              clip=False,
              preserve_range=False,
              anti_aliasing=anti_aliasing,
          )
          for channel in self.imt[0]
      ]
  
      expected = np.stack(expected).astype(np.float32)
      for p in TEST_NDARRAYS_ALL:
          im = p(self.imt[0])
          call_param = {"img": im}
          out = resize(**call_param)
          if (
              init_param["mode"] in ("bilinear", "nearest")
              and anti_aliasing is False
          ):
              test_resampler_lazy(resize, out, init_param, call_param)
          if isinstance(im, MetaTensor):
              im_inv = resize.inverse(out)
              self.assertTrue(not im_inv.applied_operations)
              assert_allclose(im_inv.shape, im.shape)
              assert_allclose(
                  im_inv.affine, im.affine, atol=1e-3, rtol=1e-3
              )
          if not anti_aliasing:
              assert_allclose(out, expected, type_test=False, atol=0.9)
              return
          # skimage uses reflect padding for anti-aliasing filter.
          # Our implementation reuses GaussianSmooth() as anti-aliasing filter, which uses zero padding instead.
          # Thus their results near the image boundary will be different.
          if isinstance(out, torch.Tensor):
              out = out.cpu().detach().numpy()
          good = np.sum(np.isclose(expected, out, atol=0.9))
          self.assertLessEqual(
              np.abs(good - expected.size) / float(expected.size),
              diff_t,
              f"at most {diff_t} percent mismatch ",
          )
  
file_path: MONAI/tests/test_resize.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import skimage.transform
  import torch
  from parameterized import parameterized
  from monai.data import MetaTensor, set_track_meta
  from monai.transforms import Resize
  from tests.lazy_transforms_utils import test_resampler_lazy
  from tests.utils import TEST_NDARRAYS_ALL, NumpyImageTestCase2D, assert_allclose, is_tf32_env, pytorch_after
label_desc: Use image node_id 3 for calling the TestResize obj's underlying member method code with example usage: obj.test_correct_results(spatial_size, mode, anti_aliasing) without return types