aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-03-27 12:34:17 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-27 12:36:52 -0700
commit7fd3ca7ab6e96af7b867c7ae56ac74a3f3393b26 (patch)
treebd1133bea749f2eb79b847e505f27b5448c78a6f
parent5da1cdcf0032f63c22afb41a460fd44c52ada048 (diff)
Updating test so that it evaluates the optimized and original graph and checks whether the output tensors produced by them are the same.
PiperOrigin-RevId: 190655831
-rw-r--r--tensorflow/core/grappler/optimizers/constant_folding_test.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/tensorflow/core/grappler/optimizers/constant_folding_test.cc b/tensorflow/core/grappler/optimizers/constant_folding_test.cc
index 6340565bcd..dc9c1053d2 100644
--- a/tensorflow/core/grappler/optimizers/constant_folding_test.cc
+++ b/tensorflow/core/grappler/optimizers/constant_folding_test.cc
@@ -614,7 +614,8 @@ TEST_F(ConstantFoldingTest, ControlDependencies) {
GrapplerItem item;
item.fetch.push_back("e");
TF_CHECK_OK(scope.ToGraphDef(&item.graph));
-
+ auto tensors_expected = EvaluateNodes(item.graph, item.fetch);
+ EXPECT_EQ(1, tensors_expected.size());
ConstantFolding optimizer(nullptr /* cpu_device */);
GraphDef output;
Status status = optimizer.Optimize(nullptr, item, &output);
@@ -641,6 +642,9 @@ TEST_F(ConstantFoldingTest, ControlDependencies) {
}
}
EXPECT_EQ(1, found);
+ auto tensors = EvaluateNodes(output, item.fetch);
+ EXPECT_EQ(1, tensors.size());
+ test::ExpectTensorEqual<int>(tensors_expected[0], tensors[0]);
}
TEST_F(ConstantFoldingTest, ControlDependenciesEmptyFetch) {