neural_compressor.strategy.utils.tuning_space

Tuning space.

Classes

TuningItem

Not displayed in API Docs.

TuningSpace

Not displayed in API Docs.

Functions

pattern_to_internal(pattern[, default_dtype])

Convert pattern to internal format.

pattern_to_path(pattern)

Convert pattern to path.

quant_mode_from_pattern(internal_pattern)

Get quant mode from internal pattern.

initial_tuning_cfg_with_quant_mode(...)

Initialize the tuning cfg.

Module Contents

class neural_compressor.strategy.utils.tuning_space.TuningItem(name, options=[], item_type=None)[source]

Not displayed in API Docs.

class neural_compressor.strategy.utils.tuning_space.TuningSpace(capability, conf, framework=None)[source]

Not displayed in API Docs.

  1. capability -> internal format -> merge -> tuning space (tree)

neural_compressor.strategy.utils.tuning_space.pattern_to_internal(pattern, default_dtype='int8')[source]

Convert pattern to internal format.

‘static’ -> (‘static’, ((‘int8’),(‘int8’))) ‘dynamic’ -> (‘dynamic’, ((‘int8’),(‘int8’))) ‘fp32’ -> (‘precision’, ((‘fp32’), (‘fp32’))) ‘bf16’ -> (‘precision’, ((‘bf16’), (‘bf16’))) (‘static’, ‘int8’) -> (‘static’, ((‘int8’),(‘int8’))) (‘dynamic’, ‘int8’) -> (‘dynamic’, ((‘int8’),(‘int8’))) (‘precision’, ‘fp32’) -> (‘precision’, ((‘fp32’), (‘fp32’)))) # ((‘fp32’), (‘fp32’)) or (‘fp32’, ‘fp32’) #TODO to add the support for mixed data type of weight and activation

neural_compressor.strategy.utils.tuning_space.pattern_to_path(pattern)[source]

Convert pattern to path.

neural_compressor.strategy.utils.tuning_space.quant_mode_from_pattern(internal_pattern)[source]

Get quant mode from internal pattern.

neural_compressor.strategy.utils.tuning_space.initial_tuning_cfg_with_quant_mode(op_name_type, quant_mode, tuning_space: TuningSpace) neural_compressor.strategy.utils.tuning_structs.OpTuningConfig[source]

Initialize the tuning cfg.

Parameters:
  • op_name_type – (op name, op type)

  • quant_mode – dynamic/static/fp32/bf16/fp16

  • tuning_space – tuning space.

step1, convert the quant_mode into internal format. step2, complete the path based. step3, get the mode item. step4, use the first option as value for method. step5, create the op tuning config.

Returns:

The initial tuning config.