parameters: (img, data_format=None, dtype=None)
return_statement: return image.img_to_array(img, data_format=data_format, **kwargs)
docstring: Converts a PIL Image instance to a Numpy array.
  
    Arguments:
        img: PIL Image instance.
        data_format: Image data format,
            either "channels_first" or "channels_last".
        dtype: Dtype to use for the returned array.
  
    Returns:
        A 3D Numpy array.
  
    Raises:
        ValueError: if invalid `img` or `data_format` is passed.
docstring_summary: Converts a PIL Image instance to a Numpy array.
docstring_tokens: Converts a PIL Image instance to a Numpy array .
function: def img_to_array(img, data_format=None, dtype=None):
    """Converts a PIL Image instance to a Numpy array.
  
    Arguments:
        img: PIL Image instance.
        data_format: Image data format,
            either "channels_first" or "channels_last".
        dtype: Dtype to use for the returned array.
  
    Returns:
        A 3D Numpy array.
  
    Raises:
        ValueError: if invalid `img` or `data_format` is passed.
    """
  
    if data_format is None:
      data_format = backend.image_data_format()
    kwargs = {}
    if 'dtype' in tf_inspect.getfullargspec(image.img_to_array)[0]:
      if dtype is None:
        dtype = backend.floatx()
      kwargs['dtype'] = dtype
    return image.img_to_array(img, data_format=data_format, **kwargs)
function_tokens: def img_to_array ( img , data_format = None , dtype = None ) : if data_format is None : data_format = backend . image_data_format ( ) kwargs = { } if 'dtype' in tf_inspect . getfullargspec ( image . img_to_array ) [ 0 ] : if dtype is None : dtype = backend . floatx ( ) kwargs [ 'dtype' ] = dtype return image . img_to_array ( img , data_format = data_format , * * kwargs )