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

Function TestUpdateFanin

tensorflow/core/grappler/mutable_graph_view_test.cc:1537–1570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1535}
1536
1537void TestUpdateFanin(absl::string_view node_name, bool node_exists,
1538 const TensorId& from_fanin, const TensorId& to_fanin,
1539 bool success, const string& error_msg,
1540 absl::Span<const string> expected_fanins) {
1541 GraphDef graph_def = SimpleMutateFaninGraph();
1542
1543 MutableGraphView graph(&graph_def);
1544
1545 NodeDef* node = graph.GetNode(node_name);
1546 if (node_exists) {
1547 EXPECT_NE(node, nullptr);
1548 } else {
1549 EXPECT_EQ(node, nullptr);
1550 }
1551
1552 absl::flat_hash_map<string, std::vector<string>> unmodified_node_inputs =
1553 GetNodeInputsFromGraph(graph_def, node_name);
1554
1555 Status s = graph.UpdateFanin(node_name, from_fanin, to_fanin);
1556 EXPECT_EQ(s.ok(), success);
1557 if (!success) {
1558 EXPECT_EQ(s.error_message(), error_msg);
1559 }
1560 if (node_exists) {
1561 CompareNodeFanins(graph, node, expected_fanins);
1562 if (success) {
1563 CheckFanoutRemoved(graph, from_fanin, node_name);
1564 }
1565 }
1566
1567 CheckUnmodifiedNodeFanins(graph_def, node_name, unmodified_node_inputs);
1568
1569 CheckGraph(graph);
1570}
1571
1572TEST(MutableGraphViewTest, UpdateFanin) {
1573 string error_msg;

Callers 1

TESTFunction · 0.85

Calls 9

SimpleMutateFaninGraphFunction · 0.85
GetNodeInputsFromGraphFunction · 0.85
CompareNodeFaninsFunction · 0.85
CheckFanoutRemovedFunction · 0.85
CheckGraphFunction · 0.85
UpdateFaninMethod · 0.80
GetNodeMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected