Could you run this code and see it the last line returns different values?
img = transforms.ToPILImage()(torch.randn(3, 600, 600))
crop = MyRandomCrop((256, 256))
crop.get_params(img, (256, 256))

If so, could you try this afterwards:
cropped = crop(img)