code: def test_orntd_torch(
      self, init_param, img: torch.Tensor, track_meta: bool, device
  ):
      set_track_meta(track_meta)
      tr = Spacingd(**init_param)
      call_param = {"data": {"seg": img.to(device)}}
      res_data = tr(**call_param)  # type: ignore
      res = res_data["seg"]
  
      if track_meta:
          test_resampler_lazy(
              tr, res_data, init_param, call_param, output_key="seg"
          )
          self.assertIsInstance(res, MetaTensor)
          assert isinstance(res, MetaTensor)  # for mypy type narrowing
          new_spacing = affine_to_spacing(res.affine, 3)
          assert_allclose(
              new_spacing, init_param["pixdim"], type_test=False
          )
          self.assertNotEqual(img.shape, res.shape)
      else:
          self.assertIsInstance(res, torch.Tensor)
          self.assertNotIsInstance(res, MetaTensor)
          self.assertNotEqual(img.shape, res.shape)
  
file_path: MONAI/tests/test_spacingd.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  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 Spacingd
  from monai.utils import ensure_tuple_rep
  from tests.lazy_transforms_utils import test_resampler_lazy
  from tests.utils import TEST_DEVICES, assert_allclose, skip_if_quick
label_desc: Use image node_id 2 for calling the TestSpacingDCase obj's underlying member method code with example usage: obj.test_orntd_torch(init_param, img, track_meta, device) without return types