Closed wilfredkisku closed 1 year ago
QKeras stores the weights in floating-point. So they are "stored" exactly as in regular keras. What qkeras does is apply "fake quantization functions" that have the signature f:Tensor[float]->Tensor[float]. But the output is constrained to the values that a quantized weight could take. I suggest you begin with taking a look at the different quantization functions (quantized_bits, binary...)
Thanks. I am able to understand the quantization technique that has been used by looking at the functions. Is there a way to store the quantized weights during each epoch of the training phase? I just want to look at the effect of quantization on optimization.
ah. I see. Well you can look at the weights as such:layer.kernel_quantizer_internal(layer.kernel)
. And for biases: layer.bias_quantizer_internal(layer.bias)
.
Thanks! works like a charm.
Being new to quantization in QKeras, is there a way I can get the quantized weights and know how they are exactly stored?
If the (min, max) values for scaling have been used how can I extract those values to verify the effective quantization in each layer?
Thanks.