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

Method GetDumpNdSbpSignatureForOpConfFn

oneflow/core/operator/variable_op.cpp:131–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131Operator::DumpNdSbpSignatureForOpConfFn VariableOp::GetDumpNdSbpSignatureForOpConfFn() const {
132 return [](const NdSbpSignature& nd_sbp_sig, OperatorConf* op_conf) -> Maybe<void> {
133 CHECK_OR_RETURN(op_conf->has_variable_conf()) << "VariableOp don't set variable op_conf";
134 op_conf->mutable_variable_conf()->clear_nd_sbp();
135 const auto& nd_sbp = nd_sbp_sig.bn_in_op2nd_sbp().at("out");
136
137 for (const auto& sbp_parallel : nd_sbp.sbp_parallel()) {
138 op_conf->mutable_variable_conf()->mutable_nd_sbp()->Add(SbpParallelToString(sbp_parallel));
139 }
140 return Maybe<void>::Ok();
141 };
142}
143
144REGISTER_OP(OperatorConf::kVariableConf, VariableOp);
145REGISTER_OP_SAME_OUTPUT_BLOB_REGST_NUM(OperatorConf::kVariableConf, 1);

Callers

nothing calls this directly

Calls 3

SbpParallelToStringFunction · 0.85
atMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected