简体   繁体   English

TensorFlow QAT 如何获得量化权重

[英]TensorFlow QAT how to get the quantized weights

How to get the values of the quantized weights or get quantization aware weights after quantization aware training (QAT) of TensorFlow.如何在 TensorFlow 的量化感知训练 (QAT) 之后获取量化权重的值或获取量化感知权重。 I want to use integer quantized weights on NumPy for an application.我想在 NumPy 上为应用程序使用整数量化权重。 I used as follows so far, which gives float32 values.到目前为止,我使用如下,它给出了 float32 值。

import tensorflow.keras.backend as K

for layer in q_aware_model.trainable_weights:
    weights_temp.append(K.get_value(layer))

to see the quantized weights you have to convert the model first.要查看量化权重,您必须先转换模型。 See process description and numpy application in this TF example请参阅此 TF 示例中的流程描述和 numpy 应用程序

Note that you may need to use nightly tf build for the quantized functions to work properly.请注意,您可能需要使用夜间 tf build 才能使量化函数正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM