parameters: (filename, color=True)
return_statement: return img
docstring: Load an image converting from grayscale or alpha as needed.
  
      Parameters
      ----------
      filename : string
      color : boolean
          flag for color format. True (default) loads as RGB while False
          loads as intensity (if image is already grayscale).
  
      Returns
      -------
      image : an image with type np.float32 in range [0, 1]
          of size (H x W x 3) in RGB or
          of size (H x W x 1) in grayscale.
docstring_summary: Load an image converting from grayscale or alpha as needed.
docstring_tokens: Load an image converting from grayscale or alpha as needed .
function: def load_image(filename, color=True):
      """
      Load an image converting from grayscale or alpha as needed.
  
      Parameters
      ----------
      filename : string
      color : boolean
          flag for color format. True (default) loads as RGB while False
          loads as intensity (if image is already grayscale).
  
      Returns
      -------
      image : an image with type np.float32 in range [0, 1]
          of size (H x W x 3) in RGB or
          of size (H x W x 1) in grayscale.
      """
      img = skimage.img_as_float(skimage.io.imread(filename, as_grey=not color)).astype(np.float32)
      if img.ndim == 2:
          img = img[:, :, np.newaxis]
          if color:
              img = np.tile(img, (1, 1, 3))
      elif img.shape[2] == 4:
          img = img[:, :, :3]
      return img
function_tokens: def load_image ( filename , color = True ) : img = skimage . img_as_float ( skimage . io . imread ( filename , as_grey = not color ) ) . astype ( np . float32 ) if img . ndim == 2 : img = img [ : , : , np . newaxis ] if color : img = np . tile ( img , ( 1 , 1 , 3 ) ) elif img . shape [ 2 ] == 4 : img = img [ : , : , : 3 ] return img