Solved by ProGamerGov in post #2 
              
              
                I’ve put together a solution that seems to work like how I want it to. One function divides the tensor into tiles, and the other puts all the tiles back together: 
import torch
import math

def roll_tensor(tensor, h_shift=None, w_shift=None):
    if h_shift == None:
       h_shift = torch.LongTensor…