parameters: (arr)
docstring: Find image type based on array dimensions.
  
    Raises error on invalid image dimensions.
    Args:
      arr: numpy array. Input array.
  
    Returns:
      str. "RGB" or "L", meant for PIL.Image.fromarray.
docstring_summary: Find image type based on array dimensions.
docstring_tokens: Find image type based on array dimensions .
function: def _get_image_type_from_array(arr):
    """Find image type based on array dimensions.
  
    Raises error on invalid image dimensions.
    Args:
      arr: numpy array. Input array.
  
    Returns:
      str. "RGB" or "L", meant for PIL.Image.fromarray.
    """
    if len(arr.shape) == 3 and arr.shape[2] == 3:
      # 8-bit x 3 colors
      return 'RGB'
    elif len(arr.shape) == 2:
      # 8-bit, gray-scale
      return 'L'
    else:
      raise ValueError(
          'Input array must have either 2 dimensions or 3 dimensions where the '
          'third dimension has 3 channels. i.e. arr.shape is (x,y) or (x,y,3). '
          'Found shape {}.'.format(arr.shape))
function_tokens: def _get_image_type_from_array ( arr ) : if len ( arr . shape ) == 3 and arr . shape [ 2 ] == 3 : # 8-bit x 3 colors return 'RGB' elif len ( arr . shape ) == 2 : # 8-bit, gray-scale return 'L' else : raise ValueError ( 'Input array must have either 2 dimensions or 3 dimensions where the ' 'third dimension has 3 channels. i.e. arr.shape is (x,y) or (x,y,3). ' 'Found shape {}.' . format ( arr . shape ) )