Mojo struct
TensorSlice
Sliced view of a tensor. This is safe to use even after the last use of tensor from which it is created. For creating a slice use the getitem method defined in tensor.
Implemented traitsβ
AnyType
,
Copyable
,
Movable
Methodsβ
__getitem__
β
__getitem__(self: Self, *indices: Int) -> SIMD[type, 1]
Gets the value at the specified indices.
Args:
- β*indices (
Int
): The indices of the value to retrieve.
Returns:
The value at the specified indices.
__setitem__
β
__setitem__(self: Self, *indices: Int, *, val: SIMD[type, 1])
Sets the value at the specified indices.
Args:
- β*indices (
Int
): The indices of the value to retrieve. - βval (
SIMD[type, 1]
): The value to store at the specified indices.
static_spec
β
static_spec(self: Self) -> StaticTensorSpec[type, rank]
Gets the static spec of the slice.
Returns:
Static tensor spec of slice.
spec
β
spec(self: Self) -> TensorSpec
Gets the spec of the slice.
Returns:
Spec of slice as TensorSpec.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
If you'd like to share more information, please report an issue on GitHub
π What went wrong?