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

Method __init__

imperative/python/megengine/traced_module/expr.py:431–447  ·  view source on GitHub ↗
(self, node, method="__call__")

Source from the content-addressed store, hash-verified

429 """
430
431 def __init__(self, node, method="__call__"):
432 super().__init__()
433 if isinstance(node, type):
434 assert issubclass(node, Tensor)
435 cls = Parameter if issubclass(node, Parameter) else Tensor
436
437 self.inputs = []
438 self.const_val = [(0, cls)]
439 else:
440 assert isinstance(node, (TensorNode, ModuleNode))
441 node.users.append(self)
442 self.inputs = [
443 node,
444 ]
445 self.const_val = []
446 self.arg_def = tree_flatten(((node,), {}))[1]
447 self.method = method
448
449 @classmethod
450 def make(cls, *args, **kwargs):

Callers

nothing calls this directly

Calls 3

tree_flattenFunction · 0.85
__init__Method · 0.45
appendMethod · 0.45

Tested by

no test coverage detected