code: def test_batch_matmul(self):
      for tr_a in (True, False):
          for tr_b in (True, False):
              for stack_a in (True, False):
                  for stack_b in (True, False):
                      shape_a = (4, 5, 3) if tr_a else (4, 3, 5)
                      if stack_a:
                          shape_a = (2,) + shape_a
                      shape_b = (4, 7, 5) if tr_b else (4, 5, 7)
                      if stack_b:
                          shape_b = (2,) + shape_b
  
                      x = random_ops.random_uniform(shape_a)
                      y = random_ops.random_uniform(shape_b)
  
                      # pylint: disable=cell-var-from-loop
                      def loop_fn(i):
                          a = array_ops.gather(x, i) if stack_a else x
                          b = array_ops.gather(y, i) if stack_b else y
                          return math_ops.matmul(
                              a, b, transpose_a=tr_a, transpose_b=tr_b
                          )
  
                      # pylint: enable=cell-var-from-loop
  
                      self._test_loop_fn(loop_fn, 2)
  
imports: import itertools
  from absl.testing import parameterized
  from tensorflow.python.eager import backprop
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import clip_ops
  from tensorflow.python.ops import linalg_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import special_math_ops
  from tensorflow.python.ops import tensor_array_grad
  from tensorflow.python.ops.parallel_for import control_flow_ops
  from tensorflow.python.ops.parallel_for.test_util import PForTestCase
  from tensorflow.python.platform import test
label_desc: Use image node_id 13 for calling the MathTest obj's underlying member method code with example usage: obj.test_batch_matmul() and returns: math_ops