While CenterCrop apparently adds zero-padding to the borders, RandomCrop fails:
import torchvision.transforms as transforms
import torchvision.transforms.functional as TF

x = TF.to_pil_image(torch.randn(3, 24, 24))
transforms.CenterCrop(50)(x)
transforms.RandomCrop(50)(x)