class_docstr: Implementation of a collate function for images.
  
  This is an implementation of the BaseCollateFunction with a concrete
  set of transforms.
  
  The set of transforms is inspired by the SimCLR paper as it has shown
  to produce powerful embeddings.
  
  Attributes:
      input_size:
          Size of the input image in pixels.
      cj_prob:
          Probability that color jitter is applied.
      cj_bright:
          How much to jitter brightness.
      cj_contrast:
          How much to jitter constrast.
      cj_sat:
          How much to jitter saturation.
      cj_hue:
          How much to jitter hue.
      min_scale:
          Minimum size of the randomized crop relative to the input_size.
      random_gray_scale:
          Probability of conversion to grayscale.
      solarize_prob:
          Probability of solarization.
      gaussian_blur:
          Probability of Gaussian blur.
      kernel_size:
          Will be deprecated in favor of `sigmas` argument. If set, the old behavior applies and `sigmas` is ignored.
          Used to calculate sigma of gaussian blur with kernel_size * input_size.
      sigmas:
          Tuple of min and max value from which the std of the gaussian kernel is sampled.
          Is ignored if `kernel_size` is set.
      vf_prob:
          Probability that vertical flip is applied.
      hf_prob:
          Probability that horizontal flip is applied.
      rr_prob:
          Probability that random rotation is applied.
      rr_degrees:
          Range of degrees to select from for random rotation. If rr_degrees is None,
          images are rotated by 90 degrees. If rr_degrees is a (min, max) tuple,
          images are rotated by a random angle in [min, max]. If rr_degrees is a
          single number, images are rotated by a random angle in
          [-rr_degrees, +rr_degrees]. All rotations are counter-clockwise.
      normalize:
          Dictionary with 'mean' and 'std' for torchvision.transforms.Normalize.
class_docstr_tok: ["Implementation","of","a","collate","function","for","images",".","This","is","an","implementation","of","the","BaseCollateFunction","with","a","concrete","set","of","transforms",".","The","set","of","transforms","is","inspired","by","the","SimCLR","paper","as","it","has","shown","to","produce","powerful","embeddings",".","Attributes",":","input_size",":","Size","of","the","input","image","in","pixels",".","cj_prob",":","Probability","that","color","jitter","is","applied",".","cj_bright",":","How","much","to","jitter","brightness",".","cj_contrast",":","How","much","to","jitter","constrast",".","cj_sat",":","How","much","to","jitter","saturation",".","cj_hue",":","How","much","to","jitter","hue",".","min_scale",":","Minimum","size","of","the","randomized","crop","relative","to","the","input_size",".","random_gray_scale",":","Probability","of","conversion","to","grayscale",".","solarize_prob",":","Probability","of","solarization",".","gaussian_blur",":","Probability","of","Gaussian","blur",".","kernel_size",":","Will","be","deprecated","in","favor","of","`","sigmas","`","argument",".","If","set",",","the","old","behavior","applies","and","`","sigmas","`","is","ignored",".","Used","to","calculate","sigma","of","gaussian","blur","with","kernel_size","*","input_size",".","sigmas",":","Tuple","of","min","and","max","value","from","which","the","std","of","the","gaussian","kernel","is","sampled",".","Is","ignored","if","`","kernel_size","`","is","set",".","vf_prob",":","Probability","that","vertical","flip","is","applied",".","hf_prob",":","Probability","that","horizontal","flip","is","applied",".","rr_prob",":","Probability","that","random","rotation","is","applied",".","rr_degrees",":","Range","of","degrees","to","select","from","for","random","rotation",".","If","rr_degrees","is","None",",","images","are","rotated","by","90","degrees",".","If","rr_degrees","is","a","(","min",",","max",")","tuple",",","images","are","rotated","by","a","random","angle","in","[","min",",","max","]",".","If","rr_degrees","is","a","single","number",",","images","are","rotated","by","a","random","angle","in","[","-rr_degrees",",","+rr_degrees","]",".","All","rotations","are","counter-clockwise",".","normalize",":","Dictionary","with","'mean","'","and","'std","'","for","torchvision.transforms.Normalize","."]
code: def __init__(
      self,
      input_size: int = 224,
      cj_prob: float = 0.8,
      cj_bright: float = 0.4,
      cj_contrast: float = 0.4,
      cj_sat: float = 0.2,
      cj_hue: float = 0.1,
      min_scale: float = 0.08,
      random_gray_scale: float = 0.2,
      solarize_prob: float = 0.1,
      gaussian_blur: float = 0.5,
      kernel_size: Optional[float] = None,
      sigmas: Tuple[float, float] = (0.2, 2),
      vf_prob: float = 0.0,
      hf_prob: float = 0.5,
      rr_prob: float = 0.0,
      rr_degrees: Union[None, float, Tuple[float, float]] = None,
      normalize: dict = imagenet_normalize,
  ):
      if isinstance(input_size, tuple):
          input_size_ = max(input_size)
      else:
          input_size_ = input_size
  
      color_jitter = T.ColorJitter(
          cj_bright, cj_contrast, cj_sat, cj_hue
      )
  
      transform = [
          T.RandomResizedCrop(size=input_size, scale=(min_scale, 1.0)),
          random_rotation_transform(
              rr_prob=rr_prob, rr_degrees=rr_degrees
          ),
          T.RandomHorizontalFlip(p=hf_prob),
          T.RandomVerticalFlip(p=vf_prob),
          T.RandomApply([color_jitter], p=cj_prob),
          T.RandomGrayscale(p=random_gray_scale),
          RandomSolarization(prob=solarize_prob),
          GaussianBlur(
              kernel_size=kernel_size, sigmas=sigmas, prob=gaussian_blur
          ),
          T.ToTensor(),
      ]
  
      if normalize:
          transform += [
              T.Normalize(mean=normalize["mean"], std=normalize["std"])
          ]
  
      transform = T.Compose(transform)
  
      super(VICRegCollateFunction, self).__init__(transform)
  
imports: import math
  from multiprocessing import Value
  from typing import List, Optional, Tuple, Union
  from warnings import warn
  import torch
  import torch.nn
  import torchvision
  import torchvision.transforms
  from PIL import Image
  from lightly.transforms import GaussianBlur, Jigsaw, RandomSolarization
  from lightly.transforms.random_crop_and_flip_with_grid import RandomResizedCropAndFlip
  from lightly.transforms.rotation import random_rotation_transform
  from lightly.transforms.utils import IMAGENET_NORMALIZE
label_desc: Use image node_id 1 to create a new VICRegCollateFunction object from inherited base classes: BaseCollateFunction with example: obj = VICRegCollateFunction(input_size, cj_prob, cj_bright, cj_contrast, cj_sat, cj_hue, min_scale, random_gray_scale, solarize_prob, gaussian_blur, kernel_size, sigmas, vf_prob, hf_prob, rr_prob, rr_degrees, normalize)