Functor#

class discopy.tensor.Functor(ob, ar)[source]#

Bases: Functor

Implements a tensor-valued rigid functor.

>>> x, y = Ty('x'), Ty('y')
>>> f = rigid.Box('f', x, x @ y)
>>> F = Functor({x: 1, y: 2}, {f: [0, 1]})
>>> F(f)
Tensor(dom=Dim(1), cod=Dim(2), array=[0, 1])