I’m trying to find a more low level pyTorch method to run the code below, as it’s really slow now with the two Python-based loops. It’s essentially a sort of “expansion” of A[] by a sliding window from B…
for i in range(100):
        for j in range(100):
            corr[i, j, :, : ] = A[i, j] * B[ i:i+25, j:j+25 ]

(the numbers 100 or 25 are just placeholders)
I’ve been stuck on this for a while and every time I find some primitive that seems it could help, it has some limitation that makes it NOT fit the problem 
Please help me Obi-Wan, you’re my only hope…