neural_compressor.common.utils.utility
The utility of common module.
Classes
Lazy import python module till use. |
|
Get CPU Info. |
|
The processor type. |
|
The statistics printer. |
Functions
|
Singleton decorator. |
|
Get the elapsed time for decorated functions. |
|
Set the random seed in config. |
|
Set the workspace in config. |
Get the workspace in config. |
|
|
Set the resume_from in config. |
|
Set the tensorboard in config. |
|
Decorator function that logs the stage of process. |
|
A decorator that keeps track of the number of times a function is called. |
Detects the processor type based on the hardware configuration. |
Module Contents
- class neural_compressor.common.utils.utility.LazyImport(module_name)[source]
Lazy import python module till use.
- neural_compressor.common.utils.utility.dump_elapsed_time(customized_msg='')[source]
Get the elapsed time for decorated functions.
- Parameters:
customized_msg (string, optional) – The parameter passed to decorator. Defaults to None.
- neural_compressor.common.utils.utility.set_random_seed(seed: int)[source]
Set the random seed in config.
- neural_compressor.common.utils.utility.set_workspace(workspace: str)[source]
Set the workspace in config.
- neural_compressor.common.utils.utility.set_resume_from(resume_from: str)[source]
Set the resume_from in config.
- neural_compressor.common.utils.utility.set_tensorboard(tensorboard: bool)[source]
Set the tensorboard in config.
- neural_compressor.common.utils.utility.log_process(mode=Mode.QUANTIZE)[source]
Decorator function that logs the stage of process.
- Parameters:
mode (Mode) – The mode of the process.
- Returns:
The decorated function.
- neural_compressor.common.utils.utility.call_counter(func)[source]
A decorator that keeps track of the number of times a function is called.
- Parameters:
func – The function to be decorated.
- Returns:
The decorated function.