MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / apply_on_var_node

Function apply_on_var_node

imperative/src/impl/ops/batch_norm.cpp:98–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98cg::OperatorNodeBase* apply_on_var_node(const OpDef& def, const VarNodeArray& inputs) {
99 auto&& bn_opr = def.cast_final_safe<BatchNorm>();
100 size_t nr_inp = inputs.size();
101 mgb_assert(
102 nr_inp == 3 || nr_inp == 5,
103 "BatchNorm expects 3 or 5 inputs; got %lu actually", nr_inp);
104 OperatorNodeConfig config{bn_opr.make_name()};
105 if (nr_inp == 3) {
106 return opr::BatchNorm::make(
107 inputs[0], inputs[1], inputs[2], bn_opr.param(), config)[0]
108 .node()
109 ->owner_opr();
110 } else {
111 return opr::BatchNorm::make(
112 inputs[0], inputs[1], inputs[2], inputs[3], inputs[4],
113 bn_opr.param(), config)[0]
114 .node()
115 ->owner_opr();
116 }
117}
118
119std::tuple<SmallVector<LogicalTensorDesc>, bool> infer_output_attrs_fallible(
120 const OpDef& def, const SmallVector<LogicalTensorDesc>& inputs) {

Callers

nothing calls this directly

Calls 7

makeFunction · 0.70
sizeMethod · 0.45
make_nameMethod · 0.45
owner_oprMethod · 0.45
nodeMethod · 0.45
paramMethod · 0.45
usable_outputMethod · 0.45

Tested by

no test coverage detected