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

Method dump_var_info

src/core/impl/graph/helper.cpp:45–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45std::string cg::dump_var_info(const VarNodeArrayView& vars) {
46 std::string rst;
47 int idx = 0;
48 for (auto i : vars) {
49 if (!rst.empty())
50 rst.append(" ");
51 auto opr = i->owner_opr();
52 if (vars.size() > 1)
53 rst.append(ssprintf("%d=", idx++));
54 bool valid = i->dev_tensor_valid();
55 auto slot = find(opr->output(), i) - opr->output().begin();
56 auto&& it = i->owner_graph()->static_infer_manager().get_infer_type(i);
57 rst.append(ssprintf(
58 "{id:%zu, %s:%s, %s, "
59 "owner:%s{%s}, name:%s, slot:%td, %s, %c, %d, %d}",
60 i->id(), valid ? "layout" : "shape",
61 valid ? i->layout().to_string().c_str()
62 : i->shape().to_string().c_str(),
63 i->dtype().name(), opr->cname(), opr->dyn_typeinfo()->name, i->cname(),
64 slot, i->comp_node().to_string().c_str(),
65 cg::is_static_var_storage(i) ? 's' : 'd', static_cast<int>(it.shape),
66 static_cast<int>(it.value)));
67 }
68 return rst;
69}
70
71SymbolVar cg::grad(
72 SymbolVar target, SymbolVar wrt, bool warn_mid_wrt,

Callers

nothing calls this directly

Calls 15

is_static_var_storageFunction · 0.85
dev_tensor_validMethod · 0.80
findFunction · 0.50
emptyMethod · 0.45
appendMethod · 0.45
owner_oprMethod · 0.45
sizeMethod · 0.45
outputMethod · 0.45
beginMethod · 0.45
get_infer_typeMethod · 0.45
owner_graphMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected