Mojo trait
TensorLike
A trait which exposes functions common to all tensor types.
Implemented traits
AnyType
,
UnknownDestructibility
Methods
spec
spec(self: _Self) -> TensorSpec
Gets the TensorSpec
of this tensor, which provides meta-data about the tensor.
Returns:
The static TensorSpec
for this tensor.
unsafe_ptr
unsafe_ptr[type: DType](self: _Self) -> UnsafePointer[SIMD[type, 1]]
Gets the pointer stored in this tensor.
Danger: You should avoid using this function because the returned pointer can modify the invariants of this tensor and lead to unexpected behavior.
Parameters:
- type (
DType
): The type of theUnsafePointer
in this tensor.
Returns:
The UnsafePointer
which contains the data for this tensor.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!