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

Function TestSwapNodeNames

tensorflow/core/grappler/mutable_graph_view_test.cc:458–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458void TestSwapNodeNames(bool update_fanouts) {
459 GraphDef graph_def = SimpleSwapNodeNamesMutationGraph();
460
461 MutableGraphView graph(&graph_def);
462
463 TF_EXPECT_OK(graph.SwapNodeNames("foo_1", "foo_2", update_fanouts));
464
465 CheckNode(graph, "a", "NotImportant", "", {}, {}, {"switch_1"});
466 CheckNode(graph, "switch_1", "Switch", "", {}, {"a"}, {"identity_1"});
467 CheckNode(graph, "identity_1", "Identity", "", {}, {"switch_1:1"},
468 {"foo_2", "^foo_2"});
469 CheckNode(graph, "b", "NotImportant", "", {}, {}, {"switch_2"});
470 CheckNode(graph, "switch_2", "Switch", "", {}, {"b"}, {"identity_2"});
471 CheckNode(graph, "identity_2", "Identity", "", {}, {"switch_2:0"},
472 {"foo_1", "^foo_1"});
473 CheckNode(graph, "foo_2", "NotImportant", "", {},
474 {"identity_1", "^identity_1"}, {});
475 CheckNode(graph, "foo_1", "NotImportant", "", {},
476 {"identity_2", "^identity_2"}, {});
477
478 CheckGraph(graph);
479}
480
481TEST(MutableGraphView, SwapNodeNames) {
482 TestSwapNodeNames(/*update_fanouts=*/false);

Callers 1

TESTFunction · 0.85

Calls 4

CheckNodeFunction · 0.85
CheckGraphFunction · 0.85
SwapNodeNamesMethod · 0.80

Tested by

no test coverage detected