code: def testEagerShapeGradErrors(self):
      with context.eager_mode():
          y_backprop = array_ops.ones((2, 2, 2, 3))
          x = array_ops.ones((2, 2, 2, 2))
          scale = array_ops.ones((2,))
          reserve_space_1 = array_ops.ones((2,))
          reserve_space_2 = array_ops.ones((2,))
          with self.assertRaisesRegex(
              errors_impl.InvalidArgumentError,
              "x and y_backprop must have same shape,",
          ):
              gen_nn_ops.fused_batch_norm_grad_v2(
                  y_backprop, x, scale, reserve_space_1, reserve_space_2
              )
  
          y_backprop = array_ops.ones((2, 2, 2, 2))
          x = array_ops.ones((2, 2, 2, 2))
          scale = array_ops.ones((3,))
          reserve_space_1 = array_ops.ones((2,))
          reserve_space_2 = array_ops.ones((2,))
          with self.assertRaisesRegex(
              errors_impl.InvalidArgumentError,
              "scale must have the same number of elements",
          ):
              gen_nn_ops.fused_batch_norm_grad_v2(
                  y_backprop, x, scale, reserve_space_1, reserve_space_2
              )
  
          y_backprop = array_ops.ones((2, 2, 2, 2))
          x = array_ops.ones((2, 2, 2, 2))
          scale = array_ops.ones((2,))
          reserve_space_1 = array_ops.ones((3,))
          reserve_space_2 = array_ops.ones((2,))
          with self.assertRaisesRegex(
              errors_impl.InvalidArgumentError,
              "reserve_space_1 must have the same number of elements",
          ):
              gen_nn_ops.fused_batch_norm_grad_v2(
                  y_backprop, x, scale, reserve_space_1, reserve_space_2
              )
  
          y_backprop = array_ops.ones((2, 2, 2, 2))
          x = array_ops.ones((2, 2, 2, 2))
          scale = array_ops.ones((2,))
          reserve_space_1 = array_ops.ones((2,))
          reserve_space_2 = array_ops.ones((3,))
          with self.assertRaisesRegex(
              errors_impl.InvalidArgumentError,
              "reserve_space_2 must have the same number of elements",
          ):
              gen_nn_ops.fused_batch_norm_grad_v2(
                  y_backprop, x, scale, reserve_space_1, reserve_space_2
              )
  
imports: import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_fused_batch_norm_grad
  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 48 for calling the BatchNormalizationTest obj's underlying member method code with example usage: obj.testEagerShapeGradErrors() without return types