code: def testResizeBilinearGradBatchSharded(self, spec1, spec2):
      np.random.seed(123)
      images = constant_op.constant(
          np.random.normal(0.0, 1.0, 8 * 9 * 9).reshape([8, 9, 9, 1]),
          dtype=dtypes.float32,
      )
      grads = constant_op.constant(
          np.random.normal(0.0, 1.0, 8 * 9 * 9).reshape([8, 9, 9, 1]),
          dtype=dtypes.float32,
      )
      expected_result = gen_image_ops.resize_bilinear_grad(
          grads=grads,
          original_image=images,
          align_corners=False,
          half_pixel_centers=False,
          name=None,
      )
  
      specs = [spec1, spec2]
      layouts = [
          self.batch_layout_4d
          if spec == "sharded"
          else self.replicated_layout_4d
          for spec in specs
      ]
  
      # Test images is replicated, grads is batch sharded
      images = numpy_util.pack_numpy(images, layouts[0])
      grads = numpy_util.pack_numpy(grads, layouts[1])
  
      got = gen_image_ops.resize_bilinear_grad(
          grads=grads,
          original_image=images,
          align_corners=False,
          half_pixel_centers=False,
          name=None,
      )
      self.assertDTensorEqual(
          expected_result, self.batch_layout_4d, got
      )
  
imports: import itertools
  from absl.testing import parameterized
  import numpy
  from tensorflow.dtensor.python import api
  from tensorflow.dtensor.python import layout
  from tensorflow.dtensor.python import numpy_util
  from tensorflow.dtensor.python.tests import test_util
  from tensorflow.dtensor.python.tests import test_util_ops
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.eager.polymorphic_function import polymorphic_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.ops import gen_image_ops
  from tensorflow.python.ops import gen_linalg_ops
  from tensorflow.python.ops import nn_impl
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 12 for calling the DTensorBatchParallelSPMDTest obj's underlying member method code with example usage: obj.testResizeBilinearGradBatchSharded(spec1, spec2) without return types