Manual
Tensor Basics
Tensors are available through from pypie import Tensor
Tensor as a type
Tensor[t][s] is a type when t is a type and s is a List[int]. s can be any value--literals, variables, and function calls--as long as PyPie can infer its type as List[int].
PyPie normalizes types during type checking, e.g. Tensor[int][[a, b + c]] and Tensor[Tensor[int][[c + b]]][[a]] are identical. PyPie rewrites the shapes to identify some equalities, like b + c vs c + b. PyPie does not evaluate function calls in shapes, e.g. my_plus(b, c) is not equal to b + c, even if my_plus was just a wrapper of +.
Tensor as a constructor
Tensor converts a nested list to a tensor, e.g. Tensor([[1, 2, 3], [4, 5, 6]]) is a Tensor[int64][[2, 3]].
It optionally takes a desired type, e.g. Tensor([[1, 2, 3], [4, 5, 6]], bf16) is a Tensor[bf16][[2, 3]].
Interop with other systems
Tensor implements DLPack. It is cheap to exchange a PyPie Tensor with a counterpart in another system that also implements DLPack, like NumPy and PyTorch.