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

Function TEST_F

tensorflow/core/grappler/utils/graph_view_test.cc:970–1005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

968}
969
970TEST_F(MutationTest, AddNewNode) {
971 GraphDef graph = SimpleTestGraphForMutation();
972
973 Status s;
974 MutableGraphView graph_view(&graph, &s);
975 TF_ASSERT_OK(s);
976
977 Mutation* mutation = graph_view.GetMutationBuilder();
978
979 NodeDef empty_node;
980 mutation->AddNode(std::move(empty_node), &s);
981 TF_EXPECT_OK(s);
982 s = errors::Internal("error");
983
984 NodeDef valid_node =
985 NDef("valid", "IdentityN", {"a:1", "^b"}, {{"N", 1}}, "foo");
986 mutation->AddNode(std::move(valid_node), &s);
987 TF_EXPECT_OK(s);
988
989 NodeDef bad_node_1 =
990 NDef("bad", "IdentityN", {"^b", "a:1"}, {{"N", 1}}, "foo");
991 mutation->AddNode(std::move(bad_node_1), &s);
992 EXPECT_FALSE(s.ok());
993 EXPECT_EQ(s.error_message(),
994 "Mutation::AddNode error: node 'bad' has regular fanin 'a:1' after "
995 "controlling fanins.");
996
997 NodeDef bad_node_2 = NDef("bad", "IdentityN", {"bad:1"}, {}, "foo");
998 mutation->AddNode(std::move(bad_node_2), &s);
999 EXPECT_FALSE(s.ok());
1000 EXPECT_EQ(s.error_message(),
1001 "Mutation::AddNode error: node 'bad' has self cycle fanin "
1002 "'bad:1'.");
1003
1004 CompareGraphViewWithGraph(&graph_view, SimpleTestGraphForMutation());
1005}
1006
1007TEST_F(MutationTest, NewNodeBadFaninsAfterAdd) {
1008 GraphDef graph = SimpleTestGraphForMutation();

Callers

nothing calls this directly

Calls 15

InternalFunction · 0.85
NDefFunction · 0.85
GDefFunction · 0.85
TestGraphForMutationFunction · 0.85
GetMutationBuilderMethod · 0.80
UpdateNodeOpMethod · 0.80
UpdateNodeDeviceMethod · 0.80
AddOrUpdateNodeAttrMethod · 0.80
RemoveNodeAttrMethod · 0.80
SortTopologicallyMethod · 0.80

Tested by

no test coverage detected