Hi,
I think this post might help you:

  
    
    
    data,rect=transforms.RandomCrop((h,w))(data) I get an error,somebody help me? 
  
  
    Hi, 

RandomCrop does not return a tuple. It only crops the image and returns a Image object containing the cropped image. If you want the exact crop indices, you need to first create a RandomCrop object, then use its static method .get_params(image, output_size) which returns starting indices i and j and and the length of height and width th and tw respectively.  After this, you can call torch.nn.functional.crop(img, i, j, th, tw) to get cropped image. 
I think my explanation was a little bit c…
  


Bests