import torch.functional as F
F.pad 

has been moved to
from torchvision.transforms.functional import pad

as far as I can see.
Could you explain the % 1 and +0.5 part of your code snippet?
Isn’t % 1 always 0 ?
EDIT: Wait, I can see it. the  / 2 division is not returning an integer but a float, which results in 0.5 values for image shape length non divisible by 2