Solved by ptrblck in post #2 
              
              
                Based on the description I guess that tensor.unfold would perform the same operation (with an additional F.pad before if needed).