MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / AddOp

Method AddOp

oneflow/api/cpp/framework/graph.cpp:328–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328of::Maybe<void> Graph::GraphImpl::AddOp(of::OperatorConf op_conf) {
329 {
330 const std::shared_ptr<of::Scope> scope = JUST(of::GetCurrentScope());
331 op_conf.set_scope_symbol_id(scope->symbol_id().value_or(0));
332 }
333 op_conf.set_device_tag(GetDeviceTag(device_));
334 if (batch_size_ > 0 && op_conf.has_input_conf()) {
335 op_conf.mutable_input_conf()->mutable_blob_conf()->mutable_shape()->mutable_dim()->Set(
336 0, batch_size_);
337 }
338 auto* ctx = JUST(of::GetCurInferCtx());
339 JUST(ctx->AddAndInferGlobalOp(op_conf));
340 return of::Maybe<void>::Ok();
341}
342
343of::Maybe<void> Graph::GraphImpl::BuildGraph() {
344 CompileScope build_graph_scope(job_.job_conf(), *device_.device_->shared_from_symbol());

Callers

nothing calls this directly

Calls 6

GetCurrentScopeFunction · 0.85
GetDeviceTagFunction · 0.85
GetCurInferCtxFunction · 0.85
AddAndInferGlobalOpMethod · 0.80
value_orMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected