code: def test_2d_linear_partial_shapes(self):
      test_grid = tf.constant(
          [[[0.25, 0.25], [0.25, 0.78]], [[0.62, 0.25], [0.25, 0.28]]],
          dtype=tf.float32,
      )
      expected = [
          [[2.5, 3.5, -1.75], [3.56, 4.56, -2.28]],
          [[11.98, 12.98, -6.49], [10.56, 11.56, -5.78]],
      ]
      interp = "linear"
  
      for b in ("ZERO",):
          self._test_partial_shape_correctness(
              input=self.get_2d_input(False),
              rank=2,
              batch_size=2,
              grid=test_grid,
              interpolation=interp,
              boundary=b,
              expected_value=expected,
          )
  
          with self.assertRaisesRegexp(TypeError, "shape"):
              self._test_partial_shape_correctness(
                  input=self.get_2d_input(False),
                  rank=2,
                  batch_size=-1,
                  grid=test_grid,
                  interpolation=interp,
                  boundary=b,
                  expected_value=None,
              )
  
          with self.assertRaisesRegexp(TypeError, "shape"):
              self._test_partial_shape_correctness(
                  input=self.get_2d_input(False),
                  rank=-1,
                  batch_size=-1,
                  grid=test_grid,
                  interpolation=interp,
                  boundary=b,
                  expected_value=None,
              )
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import tensorflow
  import tensorflow.test
  from niftynet.contrib.layer.resampler_optional_niftyreg import ResamplerOptionalNiftyRegLayer
  from tests.niftynet_testcase import NiftyNetTestCase
  import niftynet.contrib.layer.resampler_optional_niftyreg
label_desc: Use image node_id 14 for calling the ResamplerTest obj's underlying member method code with example usage: obj.test_2d_linear_partial_shapes() without return types