Tensor

class madspace.Tensor

Bases: pybind11_object

Reference-counted, device-aware N-dimensional array.

The runtime’s tensor type: a typed, strided view onto a block of memory on a specific Device (CPU, CUDA, or HIP), shared through reference counting so copying a Tensor is cheap. Compute-graph values, matrix element results, trainable globals and event data all flow through this type. From Python a Tensor is only ever obtained from another madspace call, never constructed directly; it exports itself through the __dlpack__ / __dlpack_device__ protocol so it converts to a NumPy array or a PyTorch tensor without copying.

numpy()
torch()