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

Method calculate

imperative/python/megengine/jit/tracing.py:945–958  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

943 return tensor(value, dtype=dtype, device=device)._dev_tensor()
944
945 def calculate(*args, **kwargs):
946 output_val = []
947 # set inputs value
948 for name, var in inputs.items():
949 val = kwargs.pop(name, None)
950 assert val is not None, "miss input name{}".format(name)
951 dev_tensor = make_dev_tensor(val, dtype=var.dtype, device="xpux")
952 inp_map[name].set_value(dev_tensor)
953
954 func.execute()
955
956 for res in output_nodes:
957 output_val.append(res.get_value().numpy())
958 return output_val
959
960 def expect_name(var):
961 return "{}:expect".format(var.name)

Callers

nothing calls this directly

Calls 8

make_dev_tensorFunction · 0.85
itemsMethod · 0.80
formatMethod · 0.45
set_valueMethod · 0.45
executeMethod · 0.45
appendMethod · 0.45
numpyMethod · 0.45
get_valueMethod · 0.45

Tested by

no test coverage detected