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

Function get_shape_shortcut

src/opr/impl/tensor_manip.cpp:48–60  ·  view source on GitHub ↗

return x such that shape_of(var) == x

Source from the content-addressed store, hash-verified

46#if !MGB_BUILD_SLIM_SERVING
47// return x such that shape_of(var) == x
48GetVarShape* get_shape_shortcut(VarNode* var) {
49 auto opr = var->owner_opr();
50 auto otype = opr->dyn_typeinfo();
51 if (!(otype == Reshape::typeinfo() &&
52 opr->cast_final<Reshape>().param().axis == OptionalAxis::INVALID_AXIS) &&
53 otype != Broadcast::typeinfo()) {
54 return nullptr;
55 }
56 auto i1 = opr->input(1)->owner_opr();
57 if (i1->same_type<GetVarShape>())
58 return &i1->cast_final<GetVarShape>();
59 return nullptr;
60}
61#endif
62} // anonymous namespace
63// f}}}

Callers 1

makeMethod · 0.85

Calls 3

owner_oprMethod · 0.45
paramMethod · 0.45
inputMethod · 0.45

Tested by

no test coverage detected