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

Function TEST_F

tensorflow/core/graph/graph_partition_test.cc:338–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336};
337
338TEST_F(FuseRecvTest, FuseRecvNormal) {
339 string worker_device = "/job:worker/replica:0/task:0/cpu:0";
340 string ps_device = "/job:ps/replica:0/task:0/cpu:0";
341
342 auto w1 = FloatInput(in_.WithOpName("W1"), worker_device);
343 auto w2 = Scatter1to2(in_.WithOpName("W2"), worker_device, w1);
344 auto w3 = Scatter1to2(in_.WithOpName("W3"), worker_device, w1);
345 ASSERT_EQ(w2.size(), 2);
346 ASSERT_EQ(w3.size(), 2);
347 auto p1 = FakeIdentity(in_.WithOpName("P1"), ps_device, w2[0]);
348 auto p2 = FakeIdentity(in_.WithOpName("P2"), ps_device, w2[1]);
349 auto p3 = FakeIdentity(in_.WithOpName("P3"), ps_device, w3[0]);
350 auto w4 = FakeIdentity(in_.WithOpName("W4"), worker_device, w3[1]);
351
352 std::shared_ptr<Graph> g = ConstructGraph();
353
354 PartitionOptions popts;
355 popts.node_to_loc = SplitByWorker;
356 popts.new_name = [&g](const string& prefix) { return g->NewName(prefix); };
357 popts.get_incarnation = [](const string& name) {
358 return (name[0] - 'A') + 100;
359 };
360 std::unordered_map<string, GraphDef> partitions;
361 PartitionWithTensorFuse(popts, g.get(), &partitions);
362
363 ASSERT_EQ(partitions.size(), 2);
364 for (auto p : partitions) {
365 int fuse_recv_count = 0;
366 for (int i = 0; i < p.second.node_size(); ++i) {
367 if (p.second.node(i).op() == "_FuseRecv") {
368 ++fuse_recv_count;
369 }
370 }
371 if (p.first.find("ps") != std::string::npos) {
372 ASSERT_EQ(fuse_recv_count, 1);
373 } else {
374 ASSERT_EQ(fuse_recv_count, 0);
375 }
376 }
377}
378
379TEST_F(FuseRecvTest, FuseRecvNormal2) {
380 string worker_device = "/job:worker/replica:0/task:0/cpu:0";

Callers

nothing calls this directly

Calls 15

Scatter1to2Function · 0.85
FakeIdentityFunction · 0.85
PartitionWithTensorFuseFunction · 0.85
Scatter1toRef2Function · 0.85
NextIterationFunction · 0.85
CheckLoopConstructionFunction · 0.85
BuildWhileLoopFunction · 0.85
XTimesTwoFunction · 0.85
XTimesFourFunction · 0.85
WithOpNameMethod · 0.80
FloatInputFunction · 0.70
CombineFunction · 0.70

Tested by

no test coverage detected