code: def test_array_input(self, test_data, expected_shape):
      test_data = {"img": test_data}
      to_tensord = ToTensord(
          keys="img",
          dtype=torch.float32,
          device="cpu",
          wrap_sequence=True,
      )
      result = to_tensord(test_data)
      out_img = result["img"]
      self.assertTrue(isinstance(out_img, torch.Tensor))
      assert_allclose(out_img, test_data["img"], type_test=False)
      self.assertTupleEqual(out_img.shape, expected_shape)
  
      # test inverse
      inv_data = to_tensord.inverse(result)
      self.assertTrue(isinstance(inv_data["img"], np.ndarray))
      assert_allclose(
          test_data["img"], inv_data["img"], type_test=False
      )
  
file_path: MONAI/tests/test_to_tensord.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.transforms import ToTensord
  from tests.utils import HAS_CUPY, TEST_NDARRAYS, assert_allclose, optional_import
label_desc: Use image node_id 1 for calling the TestToTensord obj's underlying member method code with example usage: obj.test_array_input(test_data, expected_shape) without return types