Resizing is usually part of the preprocessing pipeline and can be done via e.g. torchvision.transforms.Resize. You could also use e.g. torch.nn.functional.interpolate, nn.Upsample2d, or adaptive pooling layers in the training loop or inside the model to change the spatial shape of the inputs.