neural_compressor.experimental.common

Intel® Neural Compressor: An open-source Python library supporting common model.

Submodules

Package Contents

Classes

Model

A wrapper of the information needed to construct a Model.

DataLoader

A wrapper of the information needed to construct a dataloader.

Postprocess

Just collect the infos to construct a Postprocess.

Metric

A wrapper of the information needed to construct a Metric.

Functions

_generate_common_dataloader(dataloader, framework[, ...])

Generate common dataloader.

class neural_compressor.experimental.common.Model

Bases: object

A wrapper of the information needed to construct a Model.

class neural_compressor.experimental.common.DataLoader(dataset, batch_size=1, collate_fn=None, last_batch='rollover', sampler=None, batch_sampler=None, num_workers=0, pin_memory=False, shuffle=False, distributed=False)

Bases: object

A wrapper of the information needed to construct a dataloader.

This class can’t yield batched data and only in this Quantization/Benchmark object’s setter method a ‘real’ calib_dataloader will be created, the reason is we have to know the framework info and only after the Quantization/Benchmark object created then framework infomation can be known. Future we will support creating iterable dataloader from neural_compressor.experimental.common.DataLoader

class neural_compressor.experimental.common.Postprocess(postprocess_cls, name='user_postprocess', **kwargs)

Bases: object

Just collect the infos to construct a Postprocess.

class neural_compressor.experimental.common.Metric(metric_cls, name='user_metric', **kwargs)

Bases: object

A wrapper of the information needed to construct a Metric.

The metric class should take the outputs of the model as the metric’s inputs, neural_compressor built-in metric always take (predictions, labels) as inputs, it’s recommended to design metric_cls to take (predictions, labels) as inputs.