<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/86378>86378</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            How are these matmuls in the MLIR toy example valid?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          nyck33
      </td>
    </tr>
</table>

<pre>
    ```
# User defined generic function that operates on unknown shaped arguments.
def multiply_transpose(a, b) {
  return transpose(a) * transpose(b);
}

def main() {
  # Define a variable `a` with shape <2, 3>, initialized with the literal value.
  # The shape is inferred from the supplied literal.
  var a = [[1, 2, 3], [4, 5, 6]];
 # b is identical to a, the literal array is implicitly reshaped: defining new
  # variables is the way to reshape arrays (element count in literal must match
  # the size of specified shape).
  var b<2, 3> = [1, 2, 3, 4, 5, 6];

  # This call will specialize `multiply_transpose` with <2, 3> for both
  # arguments and deduce a return type of <3, 2> in initialization of `c`.
  var c = multiply_transpose(a, b);
  # A second call to `multiply_transpose` with <2, 3> for both arguments will
  # reuse the previously specialized and inferred version and return `<3, 2>`
  var d = multiply_transpose(b, a);
  # A new call with `<3, 2>` for both dimension will trigger another
  # specialization of `multiply_transpose`.
  var e = multiply_transpose(c, d);
  # Finally, calling into `multiply_transpose` with incompatible shapes
  # (<2, 3> and <3, 2>) will trigger a shape inference error.
  var f = multiply_transpose(a, c);
}
```
If mat A is 2*3 as is B then both transposed are 3*2 so the shapes seem incompatible for the rule that num cols in mat A must match num cols in mat B.  

How are these valid except for `var f`?

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU-P4rgT_TTmUhoU7JCGQw7QDPqN9NvLave8cuyCeMexI9uBYT79qhygk56eHWmlVgcl9e-9V36WMZqzQ6zZes_Wh4UcUutD7W7qqxCLxutbzari_lccWLFjXMCfEQNoPBmHGs7oMBgFp8GpZLyD1M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