If there are no marked nodes, funcification should be a no-op.
| 568 | |
| 569 | // If there are no marked nodes, funcification should be a no-op. |
| 570 | TEST(EncapsulateSubgraphsTest, NoFunctions) { |
| 571 | GraphDefBuilder builder(GraphDefBuilder::kFailImmediately); |
| 572 | |
| 573 | Node* a = Input(builder.opts().WithName("A")); |
| 574 | Node* b = Input(builder.opts().WithName("B")); |
| 575 | Node* c = Unary(a, builder.opts().WithName("C")); |
| 576 | Binary(b, c, builder.opts().WithName("D")); |
| 577 | |
| 578 | GraphDef graphdef_in; |
| 579 | FunctionDefLibrary library_in; |
| 580 | TF_EXPECT_OK(builder.ToGraphDef(&graphdef_in)); |
| 581 | *library_in.add_function() = test::function::XTimesTwo(); |
| 582 | |
| 583 | GraphDef graphdef_out = graphdef_in; |
| 584 | FunctionDefLibrary library_out = library_in; |
| 585 | TF_EXPECT_OK(Encapsulate(&graphdef_out, &library_out)); |
| 586 | |
| 587 | // If there are no marked nodes, funcification should be a no-op. |
| 588 | TF_EXPECT_GRAPH_EQ(graphdef_in, graphdef_out); |
| 589 | TF_EXPECT_FUNCTIONDEFLIBRARY_EQ(library_in, library_out); |
| 590 | } |
| 591 | |
| 592 | // Test with one function to transform. |
| 593 | TEST(EncapsulateSubgraphsTest, OneFunction) { |
nothing calls this directly
no test coverage detected