MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / testMultiStack

Method testMultiStack

tensorflow/compiler/tests/stack_ops_test.py:62–77  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

60 self.assertAllClose(a, xla.compile(fn)[0].eval({x: a}))
61
62 def testMultiStack(self):
63 with self.session(), self.test_scope():
64 v = array_ops.placeholder(dtypes.float32)
65
66 def fn():
67 h1 = gen_data_flow_ops.stack_v2(5, dtypes.float32, stack_name="foo")
68 c1 = gen_data_flow_ops.stack_push_v2(h1, v)
69 with ops.control_dependencies([c1]):
70 c1 = gen_data_flow_ops.stack_pop_v2(h1, dtypes.float32)
71 h2 = gen_data_flow_ops.stack_v2(5, dtypes.float32, stack_name="bar")
72 c2 = gen_data_flow_ops.stack_push_v2(h2, 5.0)
73 with ops.control_dependencies([c2]):
74 c2 = gen_data_flow_ops.stack_pop_v2(h2, dtypes.float32)
75 return c1 + c2
76
77 self.assertAllClose(9.0, xla.compile(fn)[0].eval({v: 4.0}))
78
79 def testSameNameStacks(self):
80 """Different stacks with the same name do not interfere."""

Callers

nothing calls this directly

Calls 6

sessionMethod · 0.45
test_scopeMethod · 0.45
placeholderMethod · 0.45
assertAllCloseMethod · 0.45
evalMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected