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!