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

2026-08-25 浏览 (1)

OH_NN_QuantParam

typedef struct OH_NN_QuantParam {...} OH_NN_QuantParam

概述

量化信息。

在量化的场景中,32位浮点型数据根据以下公式量化为定点数据:

zh-cn_formulaimage_0000001405137102

其中s和z是量化参数,在OH_NN_QuantParam中通过scale和zeroPoint保存,r是浮点数,q是量化后的结果,q_min是量化后下界,q_max是量化后的上界,计算方式如下:

zh-cn_formulaimage_0000001459019845

zh-cn_formulaimage_0000001408820090

clamp函数定义如下:

zh-cn_formulaimage_0000001455538697

起始版本: 9

废弃版本: 11

替代接口: NN_QuantParam

相关模块: NeuralNetworkRuntime

所在头文件: neural_network_runtime_type.h

汇总

成员变量

名称描述
uint32_t quantCount指定numBits、scale和zeroPoint数组的长度。在per-layer量化的场景下,quantCount通常指定为1,即一个张量所有通道共享一套量化参数;在per-channel量化场景下,quantCount通常和张量通道数一致,每个通道使用自己的量化参数。
const uint32_t *numBits量化位数。
const double *scale指向量化公式中scale数据的指针。
const int32_t *zeroPoint指向量化公式中zero point数据的指针。

你可能感兴趣的鸿蒙文章

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 鸿蒙 Readme-CN

openharmony 鸿蒙 capi-neuralnetworkruntime-nn-quantparam

openharmony 鸿蒙 capi-neuralnetworkruntime-oh-nnmodel

openharmony 鸿蒙 capi-neuralnetworkruntime-nn-tensordesc

openharmony 鸿蒙 capi-neuralnetworkruntime

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