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

Function make_tensor

imperative/python/test/helpers/utils.py:22–28  ·  view source on GitHub ↗
(x, network=None, device=None)

Source from the content-addressed store, hash-verified

20
21
22def make_tensor(x, network=None, device=None):
23 if network is not None:
24 if isinstance(x, VarNode):
25 return VarNode(x.var)
26 return network.make_const(x, device=device)
27 else:
28 return tensor(x, device=device)
29
30
31def get_var_value(x):

Callers 15

test_indexing_errorFunction · 0.90
test_basicFunction · 0.90
test_literal_arithFunction · 0.90
test_matmulFunction · 0.90
test_inplace_addFunction · 0.90
test_xFunction · 0.90
test_set_valueFunction · 0.90
test_set_subtensorFunction · 0.90
test_transposeFunction · 0.90
test_as_typeFunction · 0.90

Calls 2

VarNodeClass · 0.90
make_constMethod · 0.45

Tested by 15

test_indexing_errorFunction · 0.72
test_basicFunction · 0.72
test_literal_arithFunction · 0.72
test_matmulFunction · 0.72
test_inplace_addFunction · 0.72
test_xFunction · 0.72
test_set_valueFunction · 0.72
test_set_subtensorFunction · 0.72
test_transposeFunction · 0.72
test_as_typeFunction · 0.72