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

Function TEST

tensorflow/core/common_runtime/pending_counts_test.cc:29–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace tensorflow {
28
29TEST(PendingCounts, Simple) {
30 const int C = 300;
31 PendingCounts::Layout layout;
32 std::vector<PendingCounts::Handle> h(C);
33 for (int id = 0; id < C; id++) {
34 h[id] = layout.CreateHandle(id, id);
35 }
36
37 PendingCounts c(layout);
38 for (int id = 0; id < C; id++) {
39 c.set_initial_count(h[id], id);
40 }
41 for (int id = 0; id < C; id++) {
42 EXPECT_EQ(c.pending(h[id]), id);
43 EXPECT_EQ(c.dead_count(h[id]), 0);
44 }
45
46 for (int id = 0; id < C; id++) {
47 c.increment_dead_count(h[id]);
48 // The dead count is no longer updated once pending is 0.
49 EXPECT_EQ(c.dead_count(h[id]), (id == 0) ? 0 : 1);
50 }
51
52 EXPECT_EQ(c.decrement_pending(h[1], 1), 0);
53 EXPECT_EQ(c.decrement_pending(h[3], 1), 2);
54 EXPECT_EQ(c.decrement_pending(h[3], 1), 1);
55 c.decrement_pending(h[5], 1);
56 c.decrement_pending(h[5], 3);
57 c.decrement_pending(h[170], 1);
58 c.decrement_pending(h[170], 13);
59 EXPECT_EQ(c.pending(h[1]), 0);
60 EXPECT_EQ(c.pending(h[3]), 1);
61 EXPECT_EQ(c.pending(h[5]), 1);
62 EXPECT_EQ(c.pending(h[170]), 156);
63}
64
65TEST(PendingCounts, CopyConstructor) {
66 const int C = 300;

Callers

nothing calls this directly

Calls 15

DefaultFunction · 0.85
CreateHandleMethod · 0.80
set_initial_countMethod · 0.80
pendingMethod · 0.45
dead_countMethod · 0.45
increment_dead_countMethod · 0.45
decrement_pendingMethod · 0.45
mark_liveMethod · 0.45
mark_startedMethod · 0.45
mark_completedMethod · 0.45
node_stateMethod · 0.45
adjust_for_activationMethod · 0.45

Tested by

no test coverage detected