code: def testGradientsAxis1(self):
      np.random.seed(7)
      for shape in (2, 3), (3, 2), (8, 2, 10):
          data = np.random.randn(*shape)
          out_shape = list(shape[1:])
          out_shape.insert(1, shape[0])
          with self.subTest(shape=shape):
              with self.cached_session():
  
                  def func(*inp):
                      return array_ops_stack.stack(inp, axis=1)
  
                  # TODO(irving): Remove list() once we handle maps correctly
                  xs = list(map(constant_op.constant, data))
                  (
                      theoretical,
                      numerical,
                  ) = gradient_checker_v2.compute_gradient(func, xs)
                  self.assertAllClose(theoretical, numerical)
  
imports: import numpy
  from tensorflow.python import tf2
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  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 array_ops_stack
  from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 10 for calling the StackOpTest obj's underlying member method code with example usage: obj.testGradientsAxis1() and returns: array_ops_stack