code: def test_matrix_solve(self):
      for adjoint in (True, False):
          for stack_a in (True, False):
              for stack_b in (True, False):
                  shape_a = (2, 4, 3, 3) if stack_a else (4, 3, 3)
                  shape_b = (2, 4, 3, 5) if stack_b else (4, 3, 5)
                  x = random_ops.random_uniform(
                      shape_a
                  ) + 10 * linalg_ops.eye(
                      3
                  )  # Ensure well-conditioned.
                  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 linalg_ops.matrix_solve(
                          a, b, adjoint=adjoint
                      )
  
                  # 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 4 for calling the LinalgTest obj's underlying member method code with example usage: obj.test_matrix_solve() and returns: linalg_ops