hbDNNQuantiShift

typedef struct { int32_t shiftLen; uint8_t *shiftData; } hbDNNQuantiShift;

量化/反量化的移位数据,此量化/反量化方式J6版本已弃用,仅为了兼容J5版本保留。

对于输入 :若采集到浮点数据 data, 对应的移位数据是 shift,则送入模型的推理数据为 data(1<<shift)data * (1 < < shift) 取整。

对于输出 :若推理结果 data, 对应的移位数据是 shift,则最终的推理结果为 data/(1<<shift)data / (1 < < shift)

其中 shiftLen 由数据 data 按照 per-axisper-tensor(反)量化方式决定。 当数据 dataper-tensor (反)量化时,shiftLen 等于 1,此时不需要关注 quantizeAxis 数值; 否则 quantizeAxis 表示数据量化轴所在维度索引, shiftLen 等于数据 dataquantizeAxis 维度大小。

  • 成员
成员名称描述
shiftLen移位数据的长度。
shiftData移位数据的首地址。