parameters: (fn)
docstring: Define the coordinate mapping by its
      - axis
      - scale: output coord[i * scale] <- input_coord[i]
      - shift: output coord[i] <- output_coord[i + shift]
      s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
      (None, 1, 0) since it is independent of axis and does not transform coords.
docstring_summary: Define the coordinate mapping by its
      - axis
      - scale: output coord[i * scale] <- input_coord[i]
      - shift: output coord[i] <- output_coord[i + shift]
      s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
      (None, 1, 0) since it is independent of axis and does not transform coords.
docstring_tokens: Define the coordinate mapping by its - axis - scale : output coord [ i * scale ] < - input_coord [ i ] - shift : output coord [ i ] < - output_coord [ i + shift ] s . t . the identity mapping as for pointwise layers like ReLu is defined by ( None 1 0 ) since it is independent of axis and does not transform coords .
function: def coord_map(fn):
      """
      Define the coordinate mapping by its
      - axis
      - scale: output coord[i * scale] <- input_coord[i]
      - shift: output coord[i] <- output_coord[i + shift]
      s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
      (None, 1, 0) since it is independent of axis and does not transform coords.
      """
      if fn.type_name in ['Convolution', 'Pooling', 'Im2col']:
          axis, stride, ks, pad = conv_params(fn)
          return axis, 1 / stride, (pad - (ks - 1) / 2) / stride
      elif fn.type_name == 'Deconvolution':
          axis, stride, ks, pad = conv_params(fn)
          return axis, stride, (ks - 1) / 2 - pad
      elif fn.type_name in PASS_THROUGH_LAYERS:
          return None, 1, 0
      elif fn.type_name == 'Crop':
          axis, offset = crop_params(fn)
          axis -= 1  # -1 for last non-coordinate dim.
          return axis, 1, - offset
      else:
          raise UndefinedMapException
function_tokens: def coord_map ( fn ) : if fn . type_name in [ 'Convolution' , 'Pooling' , 'Im2col' ] : axis , stride , ks , pad = conv_params ( fn ) return axis , 1 / stride , ( pad - ( ks - 1 ) / 2 ) / stride elif fn . type_name == 'Deconvolution' : axis , stride , ks , pad = conv_params ( fn ) return axis , stride , ( ks - 1 ) / 2 - pad elif fn . type_name in PASS_THROUGH_LAYERS : return None , 1 , 0 elif fn . type_name == 'Crop' : axis , offset = crop_params ( fn ) axis -= 1 # -1 for last non-coordinate dim. return axis , 1 , - offset else : raise UndefinedMapException