neural_compressor.common.tuning_param

The tunable parameters module.

Classes

ParamLevel

Enumeration representing the different levels of tuning parameters.

TuningParam

Define the tunable parameter for the algorithm.

Module Contents

class neural_compressor.common.tuning_param.ParamLevel[source]

Enumeration representing the different levels of tuning parameters.

OP_LEVEL[source]

Represents the level of tuning parameters for operations.

OP_TYPE_LEVEL[source]

Represents the level of tuning parameters for operation types.

MODEL_LEVEL[source]

Represents the level of tuning parameters for models.

class neural_compressor.common.tuning_param.TuningParam(name: str, default_val: Any = None, tunable_type=None, options=None, level: ParamLevel = ParamLevel.OP_LEVEL)[source]

Define the tunable parameter for the algorithm.

Example

Class FakeAlgoConfig(BaseConfig):

‘’’Fake algo config.’’’.

params_list = [

… # For simple tunable types, like a list of int, giving # the param name is enough. BaseConfig class will # create the TuningParam implicitly. “simple_attr”

# For complex tunable types, like a list of lists, # developers need to create the TuningParam explicitly. TuningParam(“complex_attr”, tunable_type=List[List[str]])

# The default parameter level is ParamLevel.OP_LEVEL. # If the parameter is at a different level, developers need # to specify it explicitly. TuningParam(“model_attr”, level=ParamLevel.MODEL_LEVEL)

# TODO: more examples to explain the usage of TuningParam.