The categorical dual of transformers