@ptrblck  Sir did that. But for input
I=torch.randn(32,1,23,63)
model=MODEL(4,32,4)
O=model(I)



I am now getting an error at line
attention = nn.Softmax(torch.matmul(Q, K),dim=1)

The error is :
RuntimeError: Expected batch2_sizes[0] == bs && batch2_sizes[1] == contraction_size to be true, but got false.  (Could this error message be improved?  If so, please report an enhancement request to PyTorch.)
Plz guide