[Solved] How to quantize the weights in parameters?


It looks like relay.quantize.quantize only return a quantized graph, but leave the parameter untouched?

net = relay.quantize.quantize(net, params=params)

How could we get the quantized weights? Thanks!


The quantized params will be bind to the quantized model. They will become constants in net


Thanks for replying. How could I persist the quantized params and load it later? Thanks!



net = relay.quantize.quantize(net, params=params)

The problem is params was not touched, and still remained in float32 type. :frowning:


graph, lib, params = relay.build(net)

Then you can obtain updated params


@vinx13 Oh, I see, I should not pass params in relay.build for a quantized model. Thanks so much