code: def _test_partial_shape_correctness(
      self,
      input,
      rank,
      batch_size,
      grid,
      interpolation,
      boundary,
      expected_value=None,
  ):
      resampler = ResamplerOptionalNiftyRegLayer(
          interpolation=interpolation, boundary=boundary
      )
      input_default = tf.random_uniform(input.shape)
      if batch_size > 0 and rank > 0:
          input_placeholder = tf.placeholder_with_default(
              input_default, shape=[batch_size] + [None] * (rank + 1)
          )
      elif batch_size <= 0 and rank > 0:
          input_placeholder = tf.placeholder_with_default(
              input_default, shape=[None] * (rank + 2)
          )
      elif batch_size <= 0 and rank <= 0:
          input_placeholder = tf.placeholder_with_default(
              input_default, shape=None
          )
  
      out = resampler(input_placeholder, grid)
      with self.cached_session() as sess:
          out_value = sess.run(
              out, feed_dict={input_placeholder: input}
          )
          if expected_value is not None:
              self.assertAllClose(expected_value, out_value)
  
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 13 for calling the ResamplerTest obj's underlying member method code with example usage: obj._test_partial_shape_correctness(input, rank, batch_size, grid, interpolation, boundary, expected_value) without return types