Class TensorVar#

Inheritance Relationships#

Base Type#

Class Documentation#

class TensorVar : public tvm::Var#

Checked zero-state view over an ordinary VarObj with TensorType.

TensorVar does not introduce a runtime object or a second identity. It safely widens to Var, and get() returns the underlying VarObj used by identity-sensitive maps. operator-> exposes the same VarObj, while ty() and the metadata accessors expose its immutable TensorType access contract.

Public Types

using ContainerType = VarObj#

Public Functions

explicit TensorVar(ffi::String name, TensorType type, Location loc = UnknownLoc())#

Construct a fresh tensor variable from an explicit TensorType.

inline explicit TensorVar(Var var)#

Create a checked tensor view over an existing ordinary Var.

inline TensorType ty() const#

Return the tensor type carried by the ordinary variable.

inline const ffi::Array<PrimExpr> &shape() const#

Return the shape of the tensor.

inline PrimType dtype() const#

Return the primitive element type.

inline Expr data() const#

Project the physical pointer established by the definition site.

inline runtime::MemoryScope scope() const#

Return the storage scope associated with this tensor.

bool IsScalar(bool alloc_or_decl = true) const#

Return true if the tensor is a scalar.

Parameters:

alloc_or_decl – Whether to consider alloc_scalar and decl_scalar as scalar. True for alloc_scalar, False for decl_scalar.

inline explicit TensorVar(ffi::ObjectPtr<VarObj> node)#
inline explicit TensorVar(ffi::UnsafeInit tag)#