code: def _GetBatchMatmulGradientWithBroadcastingTest(
      dtype, adjoint_a, adjoint_b
  ):
      def Test(self):
          def CheckGradients(self, a_shape, b_shape):
              self._compare(
                  a_shape, b_shape, dtype, adjoint_a, adjoint_b
              )
  
          CheckGradients(self, [1, 5, 2, 3], [7, 1, 3, 2])
          CheckGradients(self, [2, 3], [1, 3, 5])
          CheckGradients(self, [2, 3], [5, 3, 5])
          CheckGradients(self, [5, 2, 5], [5, 3])
          CheckGradients(self, [5, 2, 2, 3], [3, 5])
          CheckGradients(self, [4, 5, 1, 2, 3], [1, 1, 3, 5])
          CheckGradients(
              self, [1, 2, 1, 4, 2, 1, 3, 4], [3, 2, 1, 1, 1, 2, 4, 2]
          )
  
      return Test
  
imports: import numpy
  from tensorflow.python import tf2
  from tensorflow.python.client import session
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import benchmark
  from tensorflow.python.platform import test
label_desc: Use image node_id 5 for calling a global function with example usage: _GetBatchMatmulGradientWithBroadcastingTest(dtype, adjoint_a, adjoint_b) and returns: Test