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

Method add_inputs

imperative/python/megengine/traced_module/expr.py:118–131  ·  view source on GitHub ↗
(self, vals)

Source from the content-addressed store, hash-verified

116 self._disable_remove = True
117
118 def add_inputs(self, vals):
119 if not isinstance(vals, collections.abc.Sequence):
120 vals = (vals,)
121 for val in vals:
122 node = NodeMixin.get(val, None)
123 if isinstance(node, (TensorNode, ModuleNode)):
124 self.inputs.append(node)
125 node.users.append(self)
126 else:
127 assert node is None
128 assert not isinstance(val, (Module, RawTensor))
129 assert _is_leaf(val) and _is_const_leaf(val)
130 idx = len(self.inputs) + len(self.const_val)
131 self.const_val.append((idx, val))
132
133 def add_outputs(self, outputs):
134 assert active_module_tracer() is not None

Callers 11

wrapped_fnFunction · 0.80
__call__Method · 0.80
matmul_scale.cppFile · 0.80
build_single_oprMethod · 0.80
build_single_oprMethod · 0.80
TESTFunction · 0.80
TESTFunction · 0.80
opr_impl.cppFile · 0.80
opr_impl.cppFile · 0.80
opr_impl.cppFile · 0.80

Calls 4

_is_const_leafFunction · 0.85
_is_leafFunction · 0.70
getMethod · 0.45
appendMethod · 0.45

Tested by 2

TESTFunction · 0.64
TESTFunction · 0.64