code: def test_gather(self):
      x = random_ops.random_uniform([3, 3, 3, 3])
      x2 = array_ops.placeholder_with_default(
          x, shape=None
      )  # Has dynamic shape.
  
      def loop_fn(i):
          outputs = []
          x_i = array_ops.gather(x, i)
          for y in [x, x2, x_i]:
              for axis in [0, 2, -1]:
                  outputs.append(array_ops.gather(y, 2, axis=axis))
                  outputs.append(
                      array_ops.gather(
                          y, math_ops.cast(2, dtypes.int64), axis=axis
                      )
                  )
                  outputs.append(
                      array_ops.gather(
                          y, 2, axis=math_ops.cast(axis, dtypes.int64)
                      )
                  )
                  outputs.append(
                      array_ops.gather(
                          y, math_ops.cast(i, dtypes.int64), axis=axis
                      )
                  )
                  outputs.append(array_ops.gather(y, [i], axis=axis))
                  outputs.append(array_ops.gather(y, [i, 2], axis=axis))
                  outputs.append(
                      array_ops.gather(y, [[2, i], [i, 1]], axis=axis)
                  )
  
              outputs.append(
                  array_ops.gather(y, [0, 1, 2], axis=1, batch_dims=1)
              )
              outputs.append(
                  array_ops.gather(y, [i, 1, 2], axis=2, batch_dims=1)
              )
              outputs.append(
                  array_ops.gather(
                      y, [[2, i], [i, 1], [2, 1]], axis=-1, batch_dims=1
                  )
              )
              outputs.append(
                  array_ops.gather(
                      y, [[0, 1, 2]] * 3, axis=2, batch_dims=2
                  )
              )
              outputs.append(
                  array_ops.gather(y, [0, 1, 2], axis=1, batch_dims=-1)
              )
              outputs.append(
                  array_ops.gather(
                      y, [[0, 1, 2]] * 3, axis=2, batch_dims=-2
                  )
              )
  
          return outputs
  
      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 1 for calling the ArrayTest obj's underlying member method code with example usage: obj.test_gather() and returns: outputs