MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / CreateControlDepVar

Method CreateControlDepVar

paddle/fluid/framework/ir/graph.h:269–284  ·  view source on GitHub ↗

Create a control dependency var that connects 2 operations. The var doesn't hold any data. Other than that, it's no different from other var, considering dependency analysis.

Source from the content-addressed store, hash-verified

267 // var doesn't hold any data. Other than that, it's no different from
268 // other var, considering dependency analysis.
269 ir::Node *CreateControlDepVar() {
270 if (FLAGS_convert_all_blocks) {
271 if (IsMainGraph()) {
272 return GetSubGraph(0)->CreateControlDepVar();
273 }
274 }
275 // TODO(panyx0718): control var name should be really unique.
276 const std::string name =
277 string::Sprintf("%s@%llu",
278 static_cast<const char *>(ir::Node::kControlDepVarName),
279 num_node_created_);
280 auto *x = AddNode(new ir::Node(name, ir::Node::Type::kVariable, block_id_));
281 x->SetId(num_node_created_++);
282 x->SetGraphId(block_id_);
283 return x;
284 }
285
286 // A more free style way of creating a graph node. Mostly use for test
287 // or "copy" from another node. Avoid using it if possible.

Callers 5

ApplyImplMethod · 0.80
CloneMethod · 0.80
CloneSubGraphMethod · 0.80
ApplyImplMethod · 0.80
TESTFunction · 0.80

Calls 3

SprintfFunction · 0.85
SetGraphIdMethod · 0.80
SetIdMethod · 0.45

Tested by 1

TESTFunction · 0.64