| 29 | namespace { |
| 30 | |
| 31 | TEST(MakeStateless, Cache) { |
| 32 | using test::function::NDef; |
| 33 | GrapplerItem item; |
| 34 | item.graph = test::function::GDef( |
| 35 | {NDef("start", "Const", {}, {{"value", 0}, {"dtype", DT_INT32}}), |
| 36 | NDef("stop", "Const", {}, {{"value", 10}, {"dtype", DT_INT32}}), |
| 37 | NDef("step", "Const", {}, {{"value", 1}, {"dtype", DT_INT32}}), |
| 38 | NDef("range", "RangeDataset", {"start", "stop", "step"}, {}), |
| 39 | NDef("filename", "Const", {}, {{"value", ""}, {"dtype", DT_INT64}}), |
| 40 | NDef("handle", "Const", {}, {{"value", 1}, {"dtype", DT_RESOURCE}}), |
| 41 | graph_tests_utils::MakeCacheV2Node("cache", "range", "filename", |
| 42 | "handle")}, |
| 43 | {}); |
| 44 | |
| 45 | MakeStateless optimizer; |
| 46 | GraphDef output; |
| 47 | TF_ASSERT_OK(optimizer.Optimize(nullptr, item, &output)); |
| 48 | EXPECT_TRUE(graph_utils::ContainsGraphNodeWithName("cache", output)); |
| 49 | int index = graph_utils::FindGraphNodeWithName("cache", output); |
| 50 | EXPECT_EQ(output.node(index).op(), "CacheDataset"); |
| 51 | EXPECT_EQ(output.node(index).input_size(), 2); |
| 52 | } |
| 53 | |
| 54 | TEST(MakeStateless, Shuffle) { |
| 55 | using test::function::NDef; |
nothing calls this directly
no test coverage detected