MCPcopy Create free account
hub / github.com/apache/tvm / Tensor

Function Tensor

python/tvm/relax/script/parser/entry.py:257–272  ·  view source on GitHub ↗
(
    shape: list[PrimExpr | str] | Expr | None = None,
    dtype: str | None = None,
    vdevice: str | None = None,
    ndim: int = -1,
)

Source from the content-addressed store, hash-verified

255
256
257def Tensor(
258 shape: list[PrimExpr | str] | Expr | None = None,
259 dtype: str | None = None,
260 vdevice: str | None = None,
261 ndim: int = -1,
262) -> TensorProxy:
263 # scalar tensor case
264 if shape is not None and not isinstance(shape, Var) and len(shape) == 0:
265 shape = []
266 if isinstance(shape, str) and dtype is None:
267 dtype = shape
268 shape = None
269
270 if shape is not None and not isinstance(shape, tuple | list) and not isinstance(shape, Expr):
271 raise ValueError(f"shape must be a list/tuple or an Expr, but got: {shape}")
272 return TensorProxy(shape, dtype, vdevice, ndim)
273
274
275############################## R.Callable ##############################

Callers

nothing calls this directly

Calls 1

TensorProxyClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…