parameters: (images, crop_dims)
return_statement: return crops
docstring: Crop images into the four corners, center, and their mirrored versions.
  
      Parameters
      ----------
      image : iterable of (H x W x K) ndarrays
      crop_dims : (height, width) tuple for the crops.
  
      Returns
      -------
      crops : (10*N x H x W x K) ndarray of crops for number of inputs N.
docstring_summary: Crop images into the four corners, center, and their mirrored versions.
docstring_tokens: Crop images into the four corners center and their mirrored versions .
function: def oversample(images, crop_dims):
      """
      Crop images into the four corners, center, and their mirrored versions.
  
      Parameters
      ----------
      image : iterable of (H x W x K) ndarrays
      crop_dims : (height, width) tuple for the crops.
  
      Returns
      -------
      crops : (10*N x H x W x K) ndarray of crops for number of inputs N.
      """
      # Dimensions and center.
      im_shape = np.array(images[0].shape)
      crop_dims = np.array(crop_dims)
      im_center = im_shape[:2] / 2.0
  
      # Make crop coordinates
      h_indices = (0, im_shape[0] - crop_dims[0])
      w_indices = (0, im_shape[1] - crop_dims[1])
      crops_ix = np.empty((5, 4), dtype=int)
      curr = 0
      for i in h_indices:
          for j in w_indices:
              crops_ix[curr] = (i, j, i + crop_dims[0], j + crop_dims[1])
              curr += 1
      crops_ix[4] = np.tile(im_center, (1, 2)) + np.concatenate([
          -crop_dims / 2.0,
           crop_dims / 2.0
      ])
      crops_ix = np.tile(crops_ix, (2, 1))
  
      # Extract crops
      crops = np.empty((10 * len(images), crop_dims[0], crop_dims[1],
                        im_shape[-1]), dtype=np.float32)
      ix = 0
      for im in images:
          for crop in crops_ix:
              crops[ix] = im[crop[0]:crop[2], crop[1]:crop[3], :]
              ix += 1
          crops[ix-5:ix] = crops[ix-5:ix, :, ::-1, :]  # flip for mirrors
      return crops
function_tokens: def oversample ( images , crop_dims ) : # Dimensions and center. im_shape = np . array ( images [ 0 ] . shape ) crop_dims = np . array ( crop_dims ) im_center = im_shape [ : 2 ] / 2.0 # Make crop coordinates h_indices = ( 0 , im_shape [ 0 ] - crop_dims [ 0 ] ) w_indices = ( 0 , im_shape [ 1 ] - crop_dims [ 1 ] ) crops_ix = np . empty ( ( 5 , 4 ) , dtype = int ) curr = 0 for i in h_indices : for j in w_indices : crops_ix [ curr ] = ( i , j , i + crop_dims [ 0 ] , j + crop_dims [ 1 ] ) curr += 1 crops_ix [ 4 ] = np . tile ( im_center , ( 1 , 2 ) ) + np . concatenate ( [ - crop_dims / 2.0 , crop_dims / 2.0 ] ) crops_ix = np . tile ( crops_ix , ( 2 , 1 ) ) # Extract crops crops = np . empty ( ( 10 * len ( images ) , crop_dims [ 0 ] , crop_dims [ 1 ] , im_shape [ - 1 ] ) , dtype = np . float32 ) ix = 0 for im in images : for crop in crops_ix : crops [ ix ] = im [ crop [ 0 ] : crop [ 2 ] , crop [ 1 ] : crop [ 3 ] , : ] ix += 1 crops [ ix - 5 : ix ] = crops [ ix - 5 : ix , : , : : - 1 , : ] # flip for mirrors return crops