code: def test_rand_3d_elasticd(
      self, input_param, input_data, expected_val
  ):
      g = Rand3DElasticd(**input_param)
      g.set_random_state(123)
      if input_param.get("device", None) is None and isinstance(
          input_data["img"], torch.Tensor
      ):
          input_data["img"].to(
              "cuda:0" if torch.cuda.is_available() else "cpu"
          )
      res = g(input_data)
      for key in res:
          result = res[key]
          expected = (
              expected_val[key]
              if isinstance(expected_val, dict)
              else expected_val
          )
          assert_allclose(
              result, expected, type_test=False, rtol=1e-2, atol=1e-2
          )
  
file_path: MONAI/tests/test_rand_elasticd_3d.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.transforms import Rand3DElasticd
  from tests.utils import TEST_NDARRAYS_ALL, assert_allclose
label_desc: Use image node_id 1 for calling the TestRand3DElasticd obj's underlying member method code with example usage: obj.test_rand_3d_elasticd(input_param, input_data, expected_val) without return types