code: def testStackPushPopSwap(self):
      with self.session(), self.test_scope():
          a = np.arange(2000)
          x = array_ops.placeholder(dtypes.float32)
  
          def fn():
              h = gen_data_flow_ops.stack_v2(
                  5, dtypes.float32, stack_name="foo"
              )
              c = gen_data_flow_ops.stack_push_v2(
                  h, x, swap_memory=True
              )
              with ops.control_dependencies([c]):
                  return gen_data_flow_ops.stack_pop_v2(
                      h, dtypes.float32
                  )
  
          self.assertAllClose(a, xla.compile(fn)[0].eval({x: a}))
  
file_path: tensorflow-upstream/tensorflow/compiler/tests/stack_ops_test.py
imports: import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.compiler.xla import xla
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_data_flow_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the StackOpTest obj's underlying member method code with example usage: obj.testStackPushPopSwap() and returns: gen_data_flow_ops