sparseml.deepsparse package

Submodules

sparseml.deepsparse.base module

sparseml.deepsparse.base. check_deepsparse_install ( min_version : Optional [ str ] = None , max_version : Optional [ str ] = None , raise_on_error : bool = True ) bool [source]

Check that the deepsparse package is installed. If raise_on_error, will raise an ImportError if it is not installed or the required version range, if set, is not installed. If not raise_on_error, will return True if installed with required version and False otherwise.

Parameters
  • min_version ( str ) – The minimum version for deepsparse that it must be greater than or equal to, if unset will require no minimum version

  • max_version ( str ) – The maximum version for deepsparse that it must be less than or equal to, if unset will require no maximum version.

  • raise_on_error ( bool ) – True to raise any issues such as not installed, minimum version, or maximum version as ImportError. False to return the result.

Returns

If raise_on_error, will return False if deepsparse is not installed or the version is outside the accepted bounds and True if everything is correct.

Return type

bool

sparseml.deepsparse.base. require_deepsparse ( min_version : Optional [ str ] = None , max_version : Optional [ str ] = None ) [source]

Decorator function to require use of deepsparse. Will check that deepsparse package is installed and within the bounding ranges of min_version and max_version if they are set before calling the wrapped function. See check_deepsparse_install() for more info.

param min_version: The minimum version for deepsparse that it must be greater than

or equal to, if unset will require no minimum version

Parameters

max_version ( str ) – The maximum version for deepsparse that it must be less than or equal to, if unset will require no maximum version.

Module contents

Functionality for working with and sparsifying Models in the DeepSparse framework