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

Function TEST_F

tensorflow/core/grappler/optimizers/static_schedule_test.cc:48–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46};
47
48TEST_F(StaticScheduleTest, BasicGraph) {
49 // This trivial graph is so basic there's nothing to prune.
50 TrivialTestGraphInputYielder fake_input(4, 1, 10, false, {"CPU:0"});
51 GrapplerItem item;
52 CHECK(fake_input.NextItem(&item));
53
54 std::unique_ptr<VirtualCluster> cluster(CreateVirtualCluster());
55
56 std::unordered_map<const NodeDef*, Costs::NanoSeconds> completion_times;
57 Status status =
58 EstimateEarliestExecutionTimes(item, cluster.get(), &completion_times);
59 TF_EXPECT_OK(status);
60
61 EXPECT_EQ(item.graph.node_size(), completion_times.size());
62
63 for (auto time : completion_times) {
64 if (time.first->name() == "Const/Const") {
65 EXPECT_EQ(Costs::NanoSeconds(1), time.second);
66 } else if (time.first->name() == "x") {
67 EXPECT_EQ(Costs::NanoSeconds(1500001), time.second);
68 } else if (time.first->name() == "Square") {
69 EXPECT_EQ(Costs::NanoSeconds(4000004), time.second);
70 } else if (time.first->name() == "Square_1") {
71 EXPECT_EQ(Costs::NanoSeconds(6500007), time.second);
72 } else if (time.first->name() == "Square_2") {
73 EXPECT_EQ(Costs::NanoSeconds(9000010), time.second);
74 } else if (time.first->name() == "Square_3") {
75 EXPECT_EQ(Costs::NanoSeconds(11500013), time.second);
76 } else if (time.first->name() == "y") {
77 EXPECT_EQ(Costs::NanoSeconds(14000013), time.second);
78 }
79 }
80}
81
82TEST_F(StaticScheduleTest, BasicGraphWithCtrlDependencies) {
83 // Build a simple graph with a control dependency.

Callers

nothing calls this directly

Calls 14

NanoSecondsClass · 0.85
EstimateRequiredTimesFunction · 0.85
WithOpNameMethod · 0.80
nameMethod · 0.65
ConstFunction · 0.50
AddNFunction · 0.50
IdentityClass · 0.50
NextItemMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
ToGraphDefMethod · 0.45

Tested by

no test coverage detected