neural_compressor.experimental.metric¶
Intel Neural Compressor Metric.
Submodules¶
neural_compressor.experimental.metric.bleuneural_compressor.experimental.metric.bleu_utilneural_compressor.experimental.metric.coco_label_mapneural_compressor.experimental.metric.coco_toolsneural_compressor.experimental.metric.evaluate_squadneural_compressor.experimental.metric.f1neural_compressor.experimental.metric.metric
Package Contents¶
Classes¶
Intel Neural Compressor Metrics. |
|
The base class of Metric. |
Functions¶
|
Decorate for registering all Metric subclasses. |
- class neural_compressor.experimental.metric.METRICS(framework: str)¶
Bases:
objectIntel Neural Compressor Metrics.
- metrics¶
The collection of registered metrics for the specified framework.
- register(name, metric_cls) None¶
Register a metric.
- Parameters:
name – The name of metric.
metric_cls – The metric class.
- class neural_compressor.experimental.metric.BaseMetric(metric, single_output=False, hvd=None)¶
Bases:
objectThe base class of Metric.
- property metric¶
Return its metric class.
- Returns:
The metric class.
- property hvd¶
Return its hvd class.
- Returns:
The hvd class.
- abstract update(preds, labels=None, sample_weight=None)¶
Update the state that need to be evaluated.
- Parameters:
preds – The prediction result.
labels – The reference. Defaults to None.
sample_weight – The sampling weight. Defaults to None.
- Raises:
NotImplementedError – The method should be implemented by subclass.
- abstract reset()¶
Clear the predictions and labels.
- Raises:
NotImplementedError – The method should be implemented by subclass.
- abstract result()¶
Evaluate the difference between predictions and labels.
- Raises:
NotImplementedError – The method should be implemented by subclass.
- neural_compressor.experimental.metric.metric_registry(metric_type: str, framework: str)¶
Decorate for registering all Metric subclasses.
The cross-framework metric is supported by specifying the framework param as one of tensorflow, pytorch, mxnet, onnxrt.
- Parameters:
metric_type – The metric type.
framework – The framework name.
- Returns:
The function to register metric class.
- Return type:
decorator_metric