code: def test_spacing_torch(self, pixdim, img, track_meta: bool):
      set_track_meta(track_meta)
      init_param = {"pixdim": pixdim}
      tr = Spacing(**init_param)
      call_param = {"data_array": img}
      res = tr(**call_param)
  
      if track_meta:
          self.assertIsInstance(res, MetaTensor)
          new_spacing = affine_to_spacing(res.affine, 3)  # type: ignore
          assert_allclose(new_spacing, pixdim, type_test=False)
          self.assertNotEqual(img.shape, res.shape)
          test_resampler_lazy(
              tr, res, init_param=init_param, call_param=call_param
          )
      else:
          self.assertIsInstance(res, torch.Tensor)
          self.assertNotIsInstance(res, MetaTensor)
          self.assertNotEqual(img.shape, res.shape)
      set_track_meta(True)
  
file_path: MONAI/tests/test_spacing.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.config import USE_COMPILED
  from monai.data.meta_obj import set_track_meta
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import affine_to_spacing
  from monai.transforms import Spacing
  from monai.utils import fall_back_tuple
  from tests.lazy_transforms_utils import test_resampler_lazy
  from tests.utils import TEST_DEVICES, TEST_NDARRAYS_ALL, assert_allclose, skip_if_quick
label_desc: Use image node_id 2 for calling the TestSpacingCase obj's underlying member method code with example usage: obj.test_spacing_torch(pixdim, img, track_meta) without return types