class discopy.tensor.Box(*args, **kwargs)[source]#

Bases: discopy.frobenius.Box, Diagram

A tensor box is a frobenius box with an array as data.

  • name – The name of the box.

  • dom – The domain of the box, i.e. its input dimension.

  • cod – The codomain of the box, i.e. its output dimension.

  • data – The array inside the tensor box.

  • dtype – The datatype for the entries of the array.


>>> b1 = Box('sauce_0', Dim(1), Dim(2), data=[0.84193562, 0.91343221])
>>> b1.eval()
Tensor[float64]([0.84193562, 0.91343221], dom=Dim(1), cod=Dim(2))