Tensor

class tract.tensor.DatumType(*values)[source]
class tract.tensor.Tensor(ptr)[source]

A multidimensional array of typed data, the fundamental data carrier in tract.

Tensors flow in and out of models: they are the inputs you feed to Runnable.run() and the outputs you get back. On the Python side, convert to and from numpy arrays with to_numpy() and from_numpy().

to_numpy() array[source]

Builds a numpy array equivalent to the data in this tensor.

into_numpy() array[source]

Same as to_numpy(), but drop the tensor content once the numpy array is built.