| 30 | namespace { |
| 31 | |
| 32 | TEST(MakeSloppy, ParallelInterleave) { |
| 33 | using test::function::NDef; |
| 34 | GrapplerItem item; |
| 35 | item.graph = test::function::GDef( |
| 36 | {NDef("start", "Const", {}, {{"value", 0}, {"dtype", DT_INT32}}), |
| 37 | NDef("stop", "Const", {}, {{"value", 10}, {"dtype", DT_INT32}}), |
| 38 | NDef("step", "Const", {}, {{"value", 1}, {"dtype", DT_INT32}}), |
| 39 | NDef("range", "RangeDataset", {"start", "stop", "step"}, {}), |
| 40 | NDef("cycle_length", "Const", {}, {{"value", 1}, {"dtype", DT_INT32}}), |
| 41 | NDef("block_length", "Const", {}, {{"value", 1}, {"dtype", DT_INT32}}), |
| 42 | NDef("num_parallel_calls", "Const", {}, |
| 43 | {{"value", 1}, {"dtype", DT_INT32}}), |
| 44 | graph_tests_utils::MakeParallelInterleaveV2Node( |
| 45 | "interleave", "range", "cycle_length", "block_length", |
| 46 | "num_parallel_calls", "XTimesTwo", /*sloppy=*/false)}, |
| 47 | // FunctionLib |
| 48 | { |
| 49 | test::function::XTimesTwo(), |
| 50 | }); |
| 51 | |
| 52 | MakeSloppy optimizer; |
| 53 | GraphDef output; |
| 54 | TF_ASSERT_OK(optimizer.Optimize(nullptr, item, &output)); |
| 55 | EXPECT_TRUE(graph_utils::ContainsGraphNodeWithName("interleave", output)); |
| 56 | int index = graph_utils::FindGraphNodeWithName("interleave", output); |
| 57 | EXPECT_TRUE(output.node(index).attr().at("sloppy").b()); |
| 58 | } |
| 59 | |
| 60 | TEST(MakeSloppy, ParallelMap) { |
| 61 | using test::function::NDef; |
nothing calls this directly
no test coverage detected