| 456 | } |
| 457 | |
| 458 | void 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 | |
| 481 | TEST(MutableGraphView, SwapNodeNames) { |
| 482 | TestSwapNodeNames(/*update_fanouts=*/false); |
no test coverage detected