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

Function update_output_shapes

src/core/impl/graph/cg_impl.cpp:53–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void update_output_shapes(
54 static_infer::StaticInferManagerImpl& infer_mgr, OperatorNodeBase* opr,
55 bool add_freeze_flag) {
56 for (auto i : opr->output()) {
57 if (add_freeze_flag) {
58 i->add_flag(VarNode::Flag::FLAG_FREEZED);
59 }
60
61 if (!i->contain_flag(VarNode::Flag::VOLATILE_CONTENT)) {
62 using namespace static_infer;
63 if (infer_mgr.get_infer_type(i).shape &
64 (InferType::CONST | InferType::RT_STATIC)) {
65 auto shp = infer_mgr.infer_shape_fallible(i);
66 if (shp) {
67 i->shape(*shp);
68 } else {
69 i->shape({});
70 }
71 } else {
72 i->shape({});
73 }
74 }
75 }
76}
77
78} // anonymous namespace
79

Callers 2

cg_impl.cppFile · 0.85

Calls 5

outputMethod · 0.45
contain_flagMethod · 0.45
get_infer_typeMethod · 0.45
infer_shape_fallibleMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected