How to resize and pad in a torchvision.transforms.Compose()?

F.pad function requires input as torch tensor but it is given PIL Image here. It throws error on me.