docstr: Randomly translate an image some fraction of total height and/or
  some fraction of total width. If the image has multiple channels,
  the same translation will be applied to each channel.
  
  Arguments
  ---------
  translation_range : two floats between [0, 1) 
      first value:
          fractional bounds of total height to shift image
          image will be horizontally shifted between 
          (-height_range * height_dimension, height_range * height_dimension)
      second value:
          fractional bounds of total width to shift image 
          Image will be vertically shifted between 
          (-width_range * width_dimension, width_range * width_dimension)
  
  interp : string in {'bilinear', 'nearest'} or list of strings
      type of interpolation to use. You can provide a different
      type of interpolation for each input, e.g. if you have two
      inputs then you can say `interp=['bilinear','nearest']
  
  lazy    : boolean
      if true, only create the affine transform matrix and return that
      if false, perform the transform on the tensor and return the tensor
docstr_tok: ["Randomly","translate","an","image","some","fraction","of","total","height","and\/or","some","fraction","of","total","width",".","If","the","image","has","multiple","channels",",","the","same","translation","will","be","applied","to","each","channel",".","Arguments","--","--","--","--","-","translation_range",":","two","floats","between","[","0",",","1",")","first","value",":","fractional","bounds","of","total","height","to","shift","image","image","will","be","horizontally","shifted","between","(","-height_range","*","height_dimension",",","height_range","*","height_dimension",")","second","value",":","fractional","bounds","of","total","width","to","shift","image","Image","will","be","vertically","shifted","between","(","-width_range","*","width_dimension",",","width_range","*","width_dimension",")","interp",":","string","in","{","'bilinear","'",",","'nearest","'","}","or","list","of","strings","type","of","interpolation","to","use",".","You","can","provide","a","different","type","of","interpolation","for","each","input",",","e.g",".","if","you","have","two","inputs","then","you","can","say","`","interp=","[","'bilinear","'",",","'nearest","'","]","lazy",":","boolean","if","true",",","only","create","the","affine","transform","matrix","and","return","that","if","false",",","perform","the","transform","on","the","tensor","and","return","the","tensor"]
code: def __init__(self, translation_range, interp="bilinear", lazy=False):
      """
      Randomly translate an image some fraction of total height and/or
      some fraction of total width. If the image has multiple channels,
      the same translation will be applied to each channel.
  
      Arguments
      ---------
      translation_range : two floats between [0, 1)
          first value:
              fractional bounds of total height to shift image
              image will be horizontally shifted between
              (-height_range * height_dimension, height_range * height_dimension)
          second value:
              fractional bounds of total width to shift image
              Image will be vertically shifted between
              (-width_range * width_dimension, width_range * width_dimension)
  
      interp : string in {'bilinear', 'nearest'} or list of strings
          type of interpolation to use. You can provide a different
          type of interpolation for each input, e.g. if you have two
          inputs then you can say `interp=['bilinear','nearest']
  
      lazy    : boolean
          if true, only create the affine transform matrix and return that
          if false, perform the transform on the tensor and return the tensor
      """
      if isinstance(translation_range, float):
          translation_range = (translation_range, translation_range)
      self.height_range = translation_range[0]
      self.width_range = translation_range[1]
      self.interp = interp
      self.lazy = lazy
  
imports: import math
  import random
  import torch
  from ..utils import th_affine2d, th_random_choice
label_desc: Use image node_id 1 to create a new RandomTranslate object  with example: obj = RandomTranslate(translation_range, interp, lazy)