brevitas
brevitas copied to clipboard
weight_quant_type
Hi,
If I create a layer using the following code which works.
my question is:
key works argument weight_quant_type could not be found in the parent class(QuantLinear, QuantWeightBiasInputOutputLayer, QuantWeightMixin, QuantProxyMixin). according to Python syntax, it should report error, however, it didn't. I get confused.....
where is weight_quant_type defined in those classes?
or is there any other explanation about the syntax of key word argument weight_quant_type?
self.fc1 = qnn.QuantLinear(input_size, 128, bias=True,
weight_quant_type=QuantType.INT,
weight_bit_width=8)
Doesn't it at least produce a warning that a keyword argument is passed but not used?
@MohamedA95 ,
The code could be run.
if the weight_quant_type syntax is wrong, it should report error instead of warning.
You could find the same example syntax in brevitas github readme page on which, both weight_bit_width and 'weight_quant_type' are the same syntax:
They are passed to functions when the API is called. however, they are not in argument list of all init function of all class.
I just noticed that those 2 arguments are passed to **kwargs, and there should be no warning nor error.
My further question is: where are those 2 argument used in Brevitas code?
The arguments are resolved through dependency injection. This page offers some insights on the architecture behind Brevitas.
We are planning to refactor how these arguments are handled to make the quantizer interface clearer.
Feel free to open a new issue or re-open this one if you have more questions.