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

Function TEST

tensorflow/core/grappler/optimizers/data/inject_prefetch_test.cc:31–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29namespace {
30
31TEST(MakeStateless, ParallelMap) {
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("num_parallel_calls", "Const", {},
40 {{"value", 1}, {"dtype", DT_INT32}}),
41 graph_tests_utils::MakeParallelMapNode("map", "range",
42 "num_parallel_calls", "XTimesTwo",
43 /*sloppy=*/false)},
44 // FunctionLib
45 {
46 test::function::XTimesTwo(),
47 });
48
49 InjectPrefetch optimizer;
50 GraphDef output;
51 TF_ASSERT_OK(optimizer.Optimize(nullptr, item, &output));
52 EXPECT_TRUE(graph_utils::ContainsNodeWithOp("PrefetchDataset", output));
53 int index = graph_utils::FindGraphNodeWithOp("PrefetchDataset", output);
54 EXPECT_FALSE(output.node(index).attr().at("legacy_autotune").b());
55}
56
57TEST(MakeStateless, ParallelInterleave) {
58 using test::function::NDef;

Callers

nothing calls this directly

Calls 13

GDefFunction · 0.85
NDefFunction · 0.85
MakeParallelMapNodeFunction · 0.85
XTimesTwoFunction · 0.85
ContainsNodeWithOpFunction · 0.85
FindGraphNodeWithOpFunction · 0.85
attrMethod · 0.80
MakeMapAndBatchNodeFunction · 0.70
OptimizeMethod · 0.45
bMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected