code: def _GetBatchMatmulGradientTest(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, 2, 3], [1, 3, 5])
          CheckGradients(self, [3, 4, 7], [3, 7, 10])
  
      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 4 for calling a global function with example usage: _GetBatchMatmulGradientTest(dtype, adjoint_a, adjoint_b) and returns: Test