code: def test_grid_pull(self, input_param, expected):
      result = grid_pull(**input_param)
      if input_param["input"].requires_grad:
          input_param["input"].retain_grad()
      if input_param["grid"].requires_grad:
          input_param["grid"].retain_grad()
      if (
          input_param["input"].requires_grad
          or input_param["grid"].requires_grad
      ):
          result.sum().backward()
  
      grads = []
      if input_param["input"].requires_grad:
          grads.append(input_param["input"].grad.view(-1))
      if input_param["grid"].requires_grad:
          grads.append(input_param["grid"].grad.view(-1))
      if not grads:
          grads = torch.tensor(0.0, device=result.device)
      elif len(grads) == 1:
          grads = grads[0]
      else:
          grads = torch.cat(grads, dim=0)
      self.assertTrue(f"{result.device}".startswith(expected["device"]))
      np.testing.assert_allclose(
          result.detach().cpu().numpy(),
          expected["val"].cpu().numpy(),
          rtol=1e-4,
          atol=1e-4,
      )
      np.testing.assert_allclose(
          grads.detach().cpu().numpy(),
          expected["grad"].cpu().numpy(),
          rtol=1e-4,
          atol=1e-4,
      )
  
file_path: MONAI/tests/test_grid_pull.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.networks.layers import grid_pull
  from monai.networks.utils import meshgrid_ij
  from monai.utils import optional_import
  from tests.testing_data.cpp_resample_answers import Expected_1D_GP_bwd, Expected_1D_GP_fwd
  from tests.utils import skip_if_no_cpp_extension
label_desc: Use image node_id 1 for calling the TestGridPull obj's underlying member method code with example usage: obj.test_grid_pull(input_param, expected) without return types