class_docstr: Tests for deprecated non-resource variant of stack ops.
code: def _testStackWhileSwap(self, use_gpu):
      with self.cached_session(use_gpu=use_gpu):
          n = constant_op.constant(0)
          h = gen_data_flow_ops._stack(dtypes.float32, stack_name="foo")
  
          def c(x):
              return math_ops.less(x, 10)
  
          def b(x):
              with ops.control_dependencies([x]):
                  a = constant_op.constant(
                      np.ones(2000), dtype=dtypes.float32
                  )
                  v = gen_data_flow_ops.stack_push(
                      h, a, swap_memory=True
                  )
              with ops.control_dependencies([v]):
                  return math_ops.add(x, 1)
  
          r = while_loop.while_loop(c, b, [n])
  
          v = constant_op.constant(np.zeros(2000), dtype=dtypes.float32)
  
          def c1(x, y):
              del y
              return math_ops.greater(x, 0)
  
          def b1(x, y):
              nx = math_ops.subtract(x, 1)
              ny = y + gen_data_flow_ops.stack_pop(h, dtypes.float32)
              return [nx, ny]
  
          _, ry = while_loop.while_loop(
              c1,
              b1,
              [r, v],
              [r.get_shape(), tensor_shape.unknown_shape()],
          )
          self.assertAllClose(np.ones(2000) * 10.0, self.evaluate(ry))
  
imports: import numpy
  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_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import gen_data_flow_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import test
label_desc: Use image node_id 6 for calling the StackOpRefTest obj's underlying member method code with example usage: obj._testStackWhileSwap(use_gpu) and returns: math_ops, math_ops, list, math_ops