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

Function TEST

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

Source from the content-addressed store, hash-verified

29namespace {
30
31TEST(ParallelBatch, Batch) {
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("batch_size", "Const", {}, {{"value", 5}, {"dtype", DT_INT32}}),
40 NDef("drop_remainder", "Const", {},
41 {{"value", false}, {"dtype", DT_BOOL}}),
42 NDef("batch", "BatchDatasetV2",
43 {"range", "batch_size", "drop_remainder"}, {})});
44
45 ParallelBatch optimizer;
46 GraphDef output;
47 TF_ASSERT_OK(optimizer.Optimize(nullptr, item, &output));
48 EXPECT_TRUE(graph_utils::ContainsGraphNodeWithName("batch", output));
49 int index = graph_utils::FindGraphNodeWithName("batch", output);
50 EXPECT_TRUE(output.node(index).attr().at("parallel_copy").b());
51}
52
53TEST(ParallelBatch, PaddedBatch) {
54 using test::function::NDef;

Callers

nothing calls this directly

Calls 9

GDefFunction · 0.85
NDefFunction · 0.85
FindGraphNodeWithNameFunction · 0.85
attrMethod · 0.80
OptimizeMethod · 0.45
bMethod · 0.45
atMethod · 0.45
nodeMethod · 0.45

Tested by

no test coverage detected