-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input scale required #423
Comments
Hi, |
@MohamedA95 I have tried my best to understand Brevitas code, but it is really hard to be understood. Is there any document about Brevitas? |
Hi, |
@MohamedA95 To be honest, my goal is to port the quantization code to C code and make it run in embedded MCU, so to understand how the code works is very important for me. I will check the document you pointed out. Thank you again! |
@MohamedA95 in fact, I previously read some quantization paper like: https://arxiv.org/pdf/2004.09602.pdf. Currently, the question/problem for me is that I want to use brevitas and want to know how it works. Please check the following test code. Currently, my questions are:
default_quant_conv = QuantConv2d(in_channels=2, out_channels=3, kernel_size=(3, 3), bias=False)
torch.nn.init.constant_(default_quant_conv.weight, 0.1)
# input = torch.randn(1, 2, 5, 5)
input = [[[1,2,3,4,5], [11,22,33,44,55], [12,13,14,15,16], [22,23,24,25,26], [33,34,35,36,37]],
[[11,12,13,14,15], [21,22,31,41,51], [31,32,33,34,36], [42,43,44,45,46], [51,52,53,54,56]]]
# input = np.ones((2,5,5)).tolist()
input = torch.unsqueeze(torch.tensor(input,dtype=torch.float32), 0)/100.0
out = default_quant_conv(input)
wq= default_quant_conv.quant_weight() |
Hi,
|
Hi @MohamedA95 for the above question 2), I get a further question: for example, if we set |
I am not sure what type is actually used but as far as I understand it can be float. You do not have to use int8 to get the values in the range of int8. In other words, you can do the quantization using the following equation Real_value=Scale*Quant_Value-Zero_point in float and then clip the values and cast the result to int. Also, AFAIK python does not support variable bit_width data type. |
Hi have you solved this problem: |
Hi @KokyoK, |
Problem solved, thanks so much. |
I also get this error, when I provide the below arguments:
I can see that, some scale are available, but issue arises when validation starts:
and then we get the error. |
Hi,
I am running the example in brevitas github page as follows.
I am experiencing the following issue:
what is 'Input scale required'?
how to scale the input? is there any example?
one more question is:
what is the request of input for the Layers in Brevitas? for example, qnn.QuanLinear, should I input float or int or uint8 to this layer?
The text was updated successfully, but these errors were encountered: