parameters: (array, dtype)
return_statement: return array
docstring: Checks array on dtype and converts it if different.
  
    Args:
      array: Input array.
      dtype: Expected dtype.
  
    Returns:
      Original array or converted.
docstring_summary: Checks array on dtype and converts it if different.
docstring_tokens: Checks array on dtype and converts it if different .
function: def check_array(array, dtype):
    """Checks array on dtype and converts it if different.
  
    Args:
      array: Input array.
      dtype: Expected dtype.
  
    Returns:
      Original array or converted.
    """
    # skip check if array is instance of other classes, e.g. h5py.Dataset
    # to avoid copying array and loading whole data into memory
    if isinstance(array, (np.ndarray, list)):
      array = np.array(array, dtype=dtype, order=None, copy=False)
    return array
function_tokens: def check_array ( array , dtype ) : # skip check if array is instance of other classes, e.g. h5py.Dataset # to avoid copying array and loading whole data into memory if isinstance ( array , ( np . ndarray , list ) ) : array = np . array ( array , dtype = dtype , order = None , copy = False ) return array