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

Function apply_on_var_node

imperative/src/impl/ops/general_norm.cpp:12–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace general_norm {
11
12cg::OperatorNodeBase* apply_on_var_node(const OpDef& def, const VarNodeArray& inputs) {
13 auto&& op = static_cast<const GeneralNorm&>(def);
14 size_t nr_inp = inputs.size();
15 auto p = op.param();
16 mgb_assert((nr_inp == 3 && p.affine) || (nr_inp == 1 && !p.affine));
17 OperatorNodeConfig config{op.make_name()};
18 if (nr_inp == 3) {
19 return opr::GeneralNorm::make(
20 inputs[0], inputs[1], inputs[2], op.param(), config)[0]
21 .node()
22 ->owner_opr();
23 } else {
24 return opr::GeneralNorm::make(inputs[0], op.param(), config)[0]
25 .node()
26 ->owner_opr();
27 }
28}
29
30std::tuple<SmallVector<LogicalTensorDesc>, bool> infer_output_attrs_fallible(
31 const OpDef& def, const SmallVector<LogicalTensorDesc>& inputs) {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected