parameters: (img, output_type)
docstring: Convert the NumPy image array to desired NumPy dtype.
  
      Args:
          img (numpy): NumPy image to cast to desired NumPy dtype.
          output_type (Numpy datatype): NumPy dtype to cast to.
  
      Returns:
          img (numpy.ndarray), Converted image.
docstring_summary: Convert the NumPy image array to desired NumPy dtype.
docstring_tokens: Convert the NumPy image array to desired NumPy dtype .
function: def to_type(img, output_type):
      """
      Convert the NumPy image array to desired NumPy dtype.
  
      Args:
          img (numpy): NumPy image to cast to desired NumPy dtype.
          output_type (Numpy datatype): NumPy dtype to cast to.
  
      Returns:
          img (numpy.ndarray), Converted image.
      """
      if not is_numpy(img):
          raise TypeError("img should be NumPy image. Got {}.".format(type(img)))
  
      try:
          return img.astype(output_type)
      except Exception:
          raise RuntimeError("output_type: " + str(output_type) + " is not a valid datatype.")
function_tokens: def to_type ( img , output_type ) : if not is_numpy ( img ) : raise TypeError ( "img should be NumPy image. Got {}." . format ( type ( img ) ) ) try : return img . astype ( output_type ) except Exception : raise RuntimeError ( "output_type: " + str ( output_type ) + " is not a valid datatype." )