remove v1 decorator

PiperOrigin-RevId: 323832211
Change-Id: I0e9d4bcd867ae6eeee933e3a29ebe69c94208145
This commit is contained in:
Yanhua Sun 2020-07-29 11:37:38 -07:00 committed by TensorFlower Gardener
parent 233d855f9c
commit d1a607adf2

View File

@ -22,6 +22,7 @@ import numpy as np
from tensorflow.python.eager import graph_only_ops
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
from tensorflow.python.ops import math_ops
from tensorflow.python.platform import test
@ -29,14 +30,14 @@ from tensorflow.python.platform import test
class GraphOnlyOpsTest(test_util.TensorFlowTestCase):
@test_util.deprecated_graph_mode_only
def testGraphPlaceholder(self):
x_tf = graph_only_ops.graph_placeholder(dtypes.int32, shape=(1,))
y_tf = math_ops.square(x_tf)
with self.cached_session() as sess:
x = np.array([42])
y = sess.run(y_tf, feed_dict={x_tf: np.array([42])})
self.assertAllClose(np.square(x), y)
with ops.Graph().as_default():
x_tf = graph_only_ops.graph_placeholder(dtypes.int32, shape=(1,))
y_tf = math_ops.square(x_tf)
with self.cached_session() as sess:
x = np.array([42])
y = sess.run(y_tf, feed_dict={x_tf: np.array([42])})
self.assertAllClose(np.square(x), y)
if __name__ == '__main__':