Solved by colesbury in post #6 
              
              
                This is a performance bug and should be fixed. I’ve written up a bug report here: 


@liangbright, In general broadcasting does not usually expand a tensor “physically” (in memory), but in this case matmul unnecessarily expands the tensor by calling “contiguous()” on the expanded tensor.