Solved by Nikronic in post #2 
              
              
                Hi, 
First step which is the extracting 10x30 matrices can be done in the same way as we extract patches out of matrices. The proper function for doing it is torch.unfold. 
After this, we need to compute ab.T operation over batches which torch.bmm enables us to do the dot product patch-wise. 
Finall…