Skip to main content

Mojo module

tensor

Defines tensor type, which is an owned, indexible buffer allocated on a given device.

For example, a tensor can be created and used like this:

from max.driver import Tensor
from max.tensor import TensorShape

def main():
tensor = Tensor[DType.float32, rank=2](TensorShape(1, 2))
tensor[0, 0] = 1.0
from max.driver import Tensor
from max.tensor import TensorShape

def main():
tensor = Tensor[DType.float32, rank=2](TensorShape(1, 2))
tensor[0, 0] = 1.0

Structs

  • Tensor: An owned, indexible buffer type.