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

Method update_static_infer_result

src/core/impl/graph/eager_eval.cpp:215–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215void EagerEvalManager::update_static_infer_result(OperatorNodeBase* opr) {
216 auto&& mgr =
217 ComputingGraphImpl::downcast(m_owner_graph)->static_infer_manager_impl();
218 auto sync_missing_trait =
219 [&](static_infer::StaticInferManagerImpl::TagHandler* handler) {
220 auto&& missing = mgr.get_missing_inp(handler);
221 for (auto i : missing) {
222 i->sync_from_var();
223 }
224 };
225
226 // set missing shapes/values for output shape infer
227 using InferType = static_infer::InferType;
228 for (auto var : opr->output()) {
229 auto type = mgr.get_infer_type(var);
230 if (type.shape & InferType::MISSING_INP) {
231 sync_missing_trait(mgr.get_tag_handler_for_shape(var));
232 }
233 }
234
235 // force udpate mutable src
236 for (auto&& i : opr->output()) {
237 if (i->contain_flag(VarNode::Flag::VOLATILE_CONTENT))
238 continue;
239 mgr.update_mutable_src_shape(i);
240 }
241
242 // set missing shapes/values for input value infer
243 for (auto&& dep : opr->node_prop().dep_map()) {
244 using Type = OperatorNodeBase::NodeProp::DepType;
245 if ((dep.second & Type::HOST_VALUE) && !is_static_var_value(dep.first)) {
246 sync_missing_trait(mgr.get_tag_handler_for_value(dep.first));
247 }
248 }
249}
250
251void EagerEvalManager::ensure_input_layout(VarNode* var) {
252 auto&& mem_mgr =

Callers

nothing calls this directly

Calls 8

is_static_var_valueFunction · 0.85
sync_from_varMethod · 0.80
outputMethod · 0.45
get_infer_typeMethod · 0.45
contain_flagMethod · 0.45

Tested by

no test coverage detected