(
shape: list[PrimExpr | str] | Expr | None = None,
dtype: str | None = None,
vdevice: str | None = None,
ndim: int = -1,
)
| 255 | |
| 256 | |
| 257 | def 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 ############################## |
nothing calls this directly
no test coverage detected
searching dependent graphs…