Mojo module
tensor_slice
Represents a sliced view of a tensor. The slice has lifetime same as that of the tensor from which it is created.
For example, you can create a TensorSlice and use it like this:
from max.driver import Tensor
from max.tensor import TensorShape
def main():
tensor = Tensor[DType.float32, rank=3](TensorShape(1, 2, 3))
slice_one = tensor[:]
Structsβ
- β
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.
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?