MmBackward returned an invalid gradient at index 0?

As described in the related topic. If you are not using the latest 1.9.1 release, please update to it as a broken shape check in matmul was recently fixed.