aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <bsteiner@google.com>2017-06-22 11:31:51 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-22 11:44:20 -0700
commite354ea71267d507f7c9677f4e0b536110333ec32 (patch)
treefe0e7f2154f0694a4446a7ac986b42844200b3b9
parentf5e500cfa892bfc4468db9a452e77061c269c3b1 (diff)
Replaced constant inputs with variables to ensure most of the graph doesn't get
optimized away PiperOrigin-RevId: 159853171
-rw-r--r--tensorflow/core/grappler/optimizers/memory_optimizer_test.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/tensorflow/core/grappler/optimizers/memory_optimizer_test.cc b/tensorflow/core/grappler/optimizers/memory_optimizer_test.cc
index de0043a006..eb7a8eb343 100644
--- a/tensorflow/core/grappler/optimizers/memory_optimizer_test.cc
+++ b/tensorflow/core/grappler/optimizers/memory_optimizer_test.cc
@@ -34,7 +34,7 @@ class RecomputeSubgraphTest : public ::testing::Test {};
TEST_F(RecomputeSubgraphTest, SimpleSubgraph) {
tensorflow::Scope s = tensorflow::Scope::NewRootScope();
- Output a = ops::Const(s.WithOpName("a"), 1.f, {2, 3, 4});
+ Output a = ops::Variable(s.WithOpName("a"), {2, 3, 4}, DT_FLOAT);
Output b = ops::Identity(s.WithOpName("b"), a); // Recomputed
Output c = ops::Identity(s.WithOpName("c"), b);
Output d = ops::AddN(s.WithOpName("gradients/d"), {c});
@@ -72,8 +72,8 @@ TEST_F(RecomputeSubgraphTest, SimpleSubgraph) {
TEST_F(RecomputeSubgraphTest, TwoInputSubgraphs) {
tensorflow::Scope s = tensorflow::Scope::NewRootScope();
- Output a = ops::Const(s.WithOpName("a"), 1.f, {2, 3, 4});
- Output b = ops::Const(s.WithOpName("b"), 1.f, {2, 3, 4});
+ Output a = ops::Variable(s.WithOpName("a"), {2, 3, 4}, DT_FLOAT);
+ Output b = ops::Variable(s.WithOpName("b"), {2, 3, 4}, DT_FLOAT);
Output d = ops::AddN(s.WithOpName("gradients/two_subgraph_inputs"), {a, b});
GrapplerItem item;
@@ -102,7 +102,7 @@ TEST_F(RecomputeSubgraphTest, TwoInputSubgraphs) {
TEST_F(RecomputeSubgraphTest, MultiNode) {
tensorflow::Scope s = tensorflow::Scope::NewRootScope();
- Output a = ops::Const(s.WithOpName("Conv"), 1.f, {2, 3, 4});
+ Output a = ops::Variable(s.WithOpName("Conv"), {2, 3, 4}, DT_FLOAT);
Output b = ops::Identity(s.WithOpName("BN"), a); // Recomputed
Output c = ops::Identity(s.WithOpName("ReLU"), b); // Recomputed
Output d = ops::Identity(s.WithOpName("Conv1"), c);
@@ -182,7 +182,7 @@ TEST_F(MemoryOptimizerTest, SimpleSwapping) {
// Build a simple graph with an op that's marked for swapping.
tensorflow::Scope s = tensorflow::Scope::NewRootScope();
- Output a = ops::Const(s.WithOpName("a"), 0.0f, {10, 10});
+ Output a = ops::Variable(s.WithOpName("a"), {10, 10}, DT_FLOAT);
Output b = ops::AddN(s.WithOpName("b"), {a});
Output c = ops::AddN(s.WithOpName("c"), {b});
Output d = ops::AddN(s.WithOpName("d"), {c});