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

Method check_var_after_exec

src/plugin/impl/var_sanity_check.cpp:53–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void VarSanityCheck::check_var_after_exec(
54 VarNode* var, const ComputingGraph::VarReceiverInfo& recv) {
55 bool is_empty = !var->shape().ndim ||
56 (var->dev_tensor_valid() && var->dev_tensor().empty());
57
58 if (is_empty) {
59 auto allow = var->contain_flag(VarNode::Flag::ALLOW_EMPTY_SHAPE),
60 no_alloc = var->contain_flag(VarNode::Flag::NO_ALLOC_IF_UNUSED);
61 mgb_throw_if(
62 !(allow || (no_alloc && recv.empty())) || !recv.is_empty_allowed(),
63 GraphError,
64 "empty output var after node execution: %s "
65 "(allow=%d receiver=%s)",
66 cg::dump_var_info({var}).c_str(), allow, recv.to_string().c_str());
67 }
68}
69
70/* ================= DebugLog ================= */
71#if MGB_ENABLE_GETENV && MGB_ENABLE_JSON

Callers

nothing calls this directly

Calls 7

dev_tensor_validMethod · 0.80
is_empty_allowedMethod · 0.80
shapeMethod · 0.45
emptyMethod · 0.45
dev_tensorMethod · 0.45
contain_flagMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected