Skip to content

RuntimeError: stack expects each tensor to be equal size, but got [2] at entry 0 and [2, 2] at entry 7 #88

Answered by dimkart
DJHeisenberg01 asked this question in Q&A
Discussion options

You must be logged in to vote

I see, these are imperative sentences, the type of which is usually n.r s (i.e. 2 wires in the output) and this is what causes the problem. You have these options:

  • Write a rewrite rule (or modifying the diagrams directly if you prefer) so that, when the sentence has two output wires, it adds a box that combines them into one s wire. This should be done at the string diagram level, i.e. before converting to circuits.
  • Don't use a syntax-based model; instead, use one of the word-sequence readers, e.g. cups_reader or a stairs_reader, which guarantees that every sentence has a single output wire.

I hope this helps, let us know if not.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@DJHeisenberg01
Comment options

@dimkart
Comment options

@DJHeisenberg01
Comment options

@dimkart
Comment options

Answer selected by DJHeisenberg01
@DJHeisenberg01
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants