MPSGraph | Matrix Multiplication

Hi, I am trying to write the SWIN Transformer for Image Classification using MPSGraph. The code basically runs two-nested for-loops. At one instance in the inner for-loop, we have a step where matrix multiplication is carried out. In total, this command runs 12 times, and the first 10 times it gives an accurate answer. But the 11th time the answer is completely inaccurate.

I even tried saving the tensors, as bytes, just before the matrix multiplication was carried out for the 11th time and loaded them into a separate project. There the answer was accurate.

I thought this was a memory error because I have an M1 with just 8GB ram but I even tried running my code on the M1 Ultra studio and the result was the same.

Can you please share a code snippet that reproduces this issue along with the OS that you are observing this on?

MPSGraph | Matrix Multiplication
 
 
Q