transpose on PyTorch : IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)
I want to transpose the data I have using transpose, but I am encountering such an error. My data and related process uploaded to github.
https://github.com/nurkbts/error/blob/main/error.ipynb

When using torch.bmm (batch matrix multiplication), both tensors must have three dimensions (first one being the batch). Please read the documentation for the details.
Since you were trying to use bmm, you should just use the @ operator (equivalent to applying torch.matmul). Also, don't forget to transpose. This will give you a shape (64, 64).
_scores = queries@keys.T / np.sqrt(64)

