Can this be achieved with a slicing operation?
a = torch.randn(1, 3, 224, 224)
shift = n
b = torch.zeros(1, 3, 224, 224)
if n >= 0:
  b[:,:,:,shift:] = a[:,:,:,0:224-shift]
else:
  b[:,:,:,0:224+shift] = a[:,:,:-shift:]