Patches correspond to specific locations

Does anyone know how to divide images into patches following specific patch middle point? for example, take only patches at the points [1,2], [3,8] etc’?

You could directly index the tensor with the corresponding indices creating the window.
Would that work or what is your use case exactly? :slight_smile:

Thanks a lot for the answer!
Basically, I have a tensor of B,2,H,W and set of B,N*N pairs of (X,Y), which are the middle of the patch, do you see a way to do it efficiently? With indices we should do a for loop, right?