class_docstr: Randomly flip and crop an image.
  
  A PyTorch module that applies random cropping, horizontal and vertical flipping to an image,
  and returns the transformed image and a grid tensor used to map the image back to the
  original image space in an NxN grid.
  
  Args:
      grid_size:
          The number of grid cells in the output grid tensor.
      crop_size:
          The size (in pixels) of the random crops.
      crop_min_scale:
          The minimum scale factor for random resized crops.
      crop_max_scale:
          The maximum scale factor for random resized crops.
      hf_prob:
          The probability of applying horizontal flipping to the image.
      normalize:
          A dictionary containing the mean and std values for normalizing the image.
class_docstr_tok: ["Randomly","flip","and","crop","an","image",".","A","PyTorch","module","that","applies","random","cropping",",","horizontal","and","vertical","flipping","to","an","image",",","and","returns","the","transformed","image","and","a","grid","tensor","used","to","map","the","image","back","to","the","original","image","space","in","an","NxN","grid",".","Args",":","grid_size",":","The","number","of","grid","cells","in","the","output","grid","tensor",".","crop_size",":","The","size","(","in","pixels",")","of","the","random","crops",".","crop_min_scale",":","The","minimum","scale","factor","for","random","resized","crops",".","crop_max_scale",":","The","maximum","scale","factor","for","random","resized","crops",".","hf_prob",":","The","probability","of","applying","horizontal","flipping","to","the","image",".","normalize",":","A","dictionary","containing","the","mean","and","std","values","for","normalizing","the","image","."]
docstr: Applies random cropping and horizontal flipping to an image, and returns the
  transformed image and a grid tensor used to map the image back to the original image
  space in an NxN grid.
  
  Args:
      img: The input PIL image.
  
  Returns:
      A tuple containing the transformed PIL image and the grid tensor.
docstr_tok: ["Applies","random","cropping","and","horizontal","flipping","to","an","image",",","and","returns","the","transformed","image","and","a","grid","tensor","used","to","map","the","image","back","to","the","original","image","space","in","an","NxN","grid",".","Args",":","img",":","The","input","PIL","image",".","Returns",":","A","tuple","containing","the","transformed","PIL","image","and","the","grid","tensor","."]
code: def forward(
      self, img: Image.Image
  ) -> Tuple[Image.Image, torch.Tensor]:
      """Applies random cropping and horizontal flipping to an image, and returns the
      transformed image and a grid tensor used to map the image back to the original image
      space in an NxN grid.
  
      Args:
          img: The input PIL image.
  
      Returns:
          A tuple containing the transformed PIL image and the grid tensor.
      """
  
      img, location = self.resized_crop.forward(img=img)
      img, location = self.horizontal_flip.forward(img, location)
      img, location = self.vertical_flip.forward(img, location)
      grid = self.location_to_NxN_grid(location=location)
  
      return img, grid
  
imports: from dataclasses import dataclass
  from typing import Tuple
  import torch
  import torchvision.transforms
  import torchvision.transforms.functional
  from PIL import Image
  from torch import nn
label_desc: Use image node_id 2 for calling the RandomResizedCropAndFlip obj's underlying member method code with example usage: obj.forward(img) and returns: img,  grid