code: def test_array_input(self):
      test_datas = [
          np.array([[1, 2], [3, 4]]),
          torch.as_tensor([[1, 2], [3, 4]]),
      ]
      if torch.cuda.is_available():
          test_datas.append(test_datas[-1].cuda())
      for test_data in test_datas:
          for dtype in ("tensor", "NUMPY"):
              result = EnsureType(
                  dtype,
                  dtype=np.float32 if dtype == "NUMPY" else None,
                  device="cpu",
              )(test_data)
              if dtype == "NUMPY":
                  self.assertTrue(result.dtype == np.float32)
              self.assertTrue(
                  isinstance(
                      result,
                      torch.Tensor if dtype == "tensor" else np.ndarray,
                  )
              )
              assert_allclose(result, test_data, type_test=False)
              self.assertTupleEqual(result.shape, (2, 2))
  
file_path: MONAI/tests/test_ensure_type.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from monai.data import MetaTensor
  from monai.transforms import EnsureType
  from tests.utils import assert_allclose
label_desc: Use image node_id 1 for calling the TestEnsureType obj's underlying member method code with example usage: obj.test_array_input() without return types