neural_compressor.data.transforms

Neural Compressor Built-in transforms for multiple framework backends.

Submodules

Package Contents

Classes

TRANSFORMS

Transforms collection class.

BaseTransform

The base class for transform.

Postprocess

Just collect the infos to construct a Postprocess.

Functions

transform_registry(transform_type, process, framework)

Class decorator used to register all transform subclasses.

class neural_compressor.data.transforms.TRANSFORMS(framework, process)

Bases: object

Transforms collection class.

Provide register method to register new Transforms and provide __getitem__ method to get Transforms according to Transforms type.

register(name, transform_cls)

Register new Transform according to Transforms type.

Parameters:
  • name (str) – process name

  • transform_cls (class) – process function wrapper class

class neural_compressor.data.transforms.BaseTransform

Bases: object

The base class for transform.

neural_compressor.data.transforms.transform_registry(transform_type, process, framework)

Class decorator used to register all transform subclasses.

Parameters:
  • transform_type (str) – Transform registration name

  • process (str) – support 3 process including ‘preprocess’, ‘postprocess’, ‘general’

  • framework (str) – support 4 framework including ‘tensorflow’, ‘pytorch’, ‘mxnet’, ‘onnxrt’

  • cls (class) – The class of register.

Returns:

The class of register.

Return type:

cls

class neural_compressor.data.transforms.Postprocess(postprocess_cls, name='user_postprocess', **kwargs)

Bases: object

Just collect the infos to construct a Postprocess.