code: def test_matrix_set_diag(self):
      matrices = random_ops.random_uniform([3, 4, 4])
      diags = random_ops.random_uniform([3, 4])
      bands = random_ops.random_uniform([3, 3, 4])
  
      def loop_fn(i):
          matrix_i = array_ops.gather(matrices, i)
          diag_i = array_ops.gather(diags, i)
          results = [
              array_ops.matrix_set_diag(matrix_i, diag_i),
              array_ops.matrix_set_diag(matrices[0, ...], diag_i),
              array_ops.matrix_set_diag(matrix_i, diags[0, ...]),
          ]
  
          k = (-1, 1)
          band_i = array_ops.gather(bands, i)
          for align in ["RIGHT_LEFT", "LEFT_RIGHT"]:
              results.extend(
                  [
                      array_ops.matrix_set_diag(
                          matrix_i, band_i, k=k, align=align
                      ),
                      array_ops.matrix_set_diag(
                          matrices[0, ...], band_i, k=k, align=align
                      ),
                      array_ops.matrix_set_diag(
                          matrix_i, bands[0, ...], k=k, align=align
                      ),
                  ]
              )
          return results
  
      self._test_loop_fn(loop_fn, 3)
  
imports: from tensorflow.python.eager import backprop
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  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 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 38 for calling the ArrayTest obj's underlying member method code with example usage: obj.test_matrix_set_diag() and returns: results