openharmony 鸿蒙 capi-neuralnetworkruntime-oh-nn-quantparam

2026-08-25 浏览 (1)

OH_NN_QuantParam

typedef struct OH_NN_QuantParam {...} OH_NN_QuantParam

Overview

Defines the quantization information.

In quantization scenarios, the 32-bit floating-point data type is quantized into the fixed-point data type according to the following formula:

zh-cn_formulaimage_0000001405137102

where, s and z are quantization parameters, which are stored by scale and zeroPoint in OH_NN_QuantParam. r is a floating point number, q is the quantization result, q_min is the lower bound of the quantization result, and q_max is the upper bound of the quantization result. The calculation method is as follows:

zh-cn_formulaimage_0000001459019845

zh-cn_formulaimage_0000001408820090

The clamp function is defined as follows:

zh-cn_formulaimage_0000001455538697

Since: 9

Deprecated from: 11

Substitute: NN_QuantParam

Related module: NeuralNetworkRuntime

Header file: neural_network_runtime_type.h

Summary

Member Variables

NameDescription
uint32_t quantCountLength of the numBits, scale, and zeroPoint arrays. In the per-layer quantization scenario, quantCount is usually set to 1. That is, all channels of a tensor share a set of quantization parameters. In the per-channel quantization scenario, quantCount is usually the same as the number of tensor channels, and each channel uses its own quantization parameters.
const uint32_t *numBitsNumber of quantization bits.
const double *scalePointer to the scale data in the quantization formula.
const int32_t *zeroPointPointer to the zero point data in the quantization formula.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-neuralnetworkruntime-nn-tensor

openharmony 鸿蒙 capi-neuralnetworkruntime-oh-nnexecutor

openharmony 鸿蒙 capi-neuralnetworkruntime-oh-nn-uint32array

openharmony 鸿蒙 capi-neural-network-runtime-h

openharmony 鸿蒙 capi-neuralnetworkruntime-oh-nn-tensor

openharmony 鸿蒙 capi-neuralnetworkruntime-nn-quantparam

openharmony 鸿蒙 Readme-EN

openharmony 鸿蒙 capi-neuralnetworkruntime-oh-nnmodel

openharmony 鸿蒙 capi-neuralnetworkruntime-nn-tensordesc

openharmony 鸿蒙 capi-neuralnetworkruntime

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/ZhBFDQ7V