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

Function astensor1d

imperative/python/megengine/core/tensor/utils.py:89–96  ·  view source on GitHub ↗

Convert something to 1D tensor. Support following types * sequence of scalar literal / tensor * numpy array * tensor (returned as is, regardless of dtype and device)

(x, *reference, dtype=None, device=None)

Source from the content-addressed store, hash-verified

87
88
89def astensor1d(x, *reference, dtype=None, device=None):
90 """Convert something to 1D tensor. Support following types
91
92 * sequence of scalar literal / tensor
93 * numpy array
94 * tensor (returned as is, regardless of dtype and device)
95 """
96 return astensor1d_cpp(x, dtype, device, reference)
97
98
99def _normalize_axis(

Callers 14

forwardMethod · 0.90
test_utils_astensor1dFunction · 0.90
conv_transpose2dFunction · 0.85
conv_transpose3dFunction · 0.85
make_full_if_noneFunction · 0.85
warp_perspectiveFunction · 0.85
interpolateFunction · 0.85
eyeFunction · 0.85
onesFunction · 0.85
zerosFunction · 0.85
repeatFunction · 0.85

Calls

no outgoing calls

Tested by 3

forwardMethod · 0.72
test_utils_astensor1dFunction · 0.72