TensorFlow QAT how to get the quantized weights

445 views Asked by At

How to get the values of the quantized weights or get quantization aware weights after quantization aware training (QAT) of TensorFlow. I want to use integer quantized weights on NumPy for an application. I used as follows so far, which gives float32 values.

import tensorflow.keras.backend as K

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

There are 1 answers

0
Poe Dator On

to see the quantized weights you have to convert the model first. See process description and numpy application in this TF example

Note that you may need to use nightly tf build for the quantized functions to work properly.