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

Function TEST

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

Source from the content-addressed store, hash-verified

29namespace {
30
31TEST(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
54TEST(MakeStateless, Shuffle) {
55 using test::function::NDef;

Callers

nothing calls this directly

Calls 10

GDefFunction · 0.85
NDefFunction · 0.85
MakeCacheV2NodeFunction · 0.85
FindGraphNodeWithNameFunction · 0.85
MakeShuffleV2NodeFunction · 0.85
OptimizeMethod · 0.45
opMethod · 0.45
nodeMethod · 0.45
input_sizeMethod · 0.45

Tested by

no test coverage detected