From b2888c66e67d584756bb50850ae77acede7ba8bf Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 7 May 2018 10:47:35 -0700 Subject: [PATCH] Add EvaluateNodes to HoistFactorDiv test. PiperOrigin-RevId: 195685340 --- .../core/grappler/optimizers/arithmetic_optimizer_test.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tensorflow/core/grappler/optimizers/arithmetic_optimizer_test.cc b/tensorflow/core/grappler/optimizers/arithmetic_optimizer_test.cc index e109e66..741cc13 100644 --- a/tensorflow/core/grappler/optimizers/arithmetic_optimizer_test.cc +++ b/tensorflow/core/grappler/optimizers/arithmetic_optimizer_test.cc @@ -696,6 +696,9 @@ TEST_F(ArithmeticOptimizerTest, HoistFactorDiv) { item.fetch = {"id"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); + auto tensors_expected = EvaluateNodes(item.graph, item.fetch); + EXPECT_EQ(1, tensors_expected.size()); + ArithmeticOptimizer optimizer; EnableOnlyHoistCommonFactor(&optimizer); @@ -734,6 +737,13 @@ TEST_F(ArithmeticOptimizerTest, HoistFactorDiv) { EXPECT_EQ("id", id_node->name()); EXPECT_EQ(HoistDivName("add"), id_node->input(0)); } + auto tensors = EvaluateNodes(output, item.fetch); + EXPECT_EQ(1, tensors.size()); + if (use_ints) { + test::ExpectTensorEqual(tensors_expected[0], tensors[0]); + } else { + test::ExpectTensorNear(tensors_expected[0], tensors[0], 1e-6); + } } } } -- 2.7.4