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

Function CheckAndConstructOp

oneflow/core/operator/operator.cpp:51–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51Maybe<Operator> CheckAndConstructOp(std::shared_ptr<const OperatorConf> op_conf) {
52 Operator* rptr = NewObj<int32_t, Operator>(op_conf->op_type_case(), *op_conf);
53 DeviceType device_type = JUST(DeviceType4DeviceTag(op_conf->device_tag()));
54 if (IsCpuOnly(*op_conf)) { CHECK_EQ_OR_RETURN(device_type, DeviceType::kCPU); }
55 JUST(rptr->Init(op_conf));
56 return std::shared_ptr<Operator>(rptr);
57}
58
59} // namespace
60

Callers 1

ConstructOpFunction · 0.85

Calls 3

DeviceType4DeviceTagFunction · 0.85
IsCpuOnlyFunction · 0.85
InitMethod · 0.45

Tested by

no test coverage detected