-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Implementation of nn.quantized.linear module #21921
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
Conversation
Differential Revision: D15375695 Differential Version: 85144759
Differential Revision: D15375695 Differential Version: 85155178
Differential Revision: D15375695 Differential Version: 85219380
Differential Revision: D15375695 Differential Version: 85439410
Differential Revision: D15375695 Differential Version: 85477647
Differential Revision: D15375695 Differential Version: 85509305
Differential Revision: D15375695 Differential Version: 85588772
Differential Revision: D15375695 Differential Version: 85589881
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address comments before landing
Differential Revision: D15375695 Differential Version: 85634127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we handle bias=False also?
torch/nn/quantized/modules/linear.py
Outdated
| __constants__ = ['bias', 'in_features', 'out_features'] | ||
|
|
||
| def __init__(self, in_features, out_features, bias=True): | ||
| assert bias, 'nobias is not supported Quantized Linear module yet' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should handle case with bias=False. In this case, there will be no self.bias to delete. We would still create qbias and set it to all zeros.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean just accept the argument and keep the behavior the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we use this hack then quantized module will always have bias after deserialization even when user specify bias=False.
I think we can only support it if fbgemm has nobias implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
Differential Revision: D15375695 Differential Version: 85655452
Differential Revision: D15375695 Differential Version: 85656064
Differential Revision: D15375695 Differential Version: 85723371
|
This pull request has been merged in 5c46e70. |
Summary: Pull Request resolved: pytorch#21921 Call FBGEMM kernels to implement quantized linear operator. This operator is used only for inference. Differential Revision: D15375695 fbshipit-source-id: b9ca6c156fd60481fea83e55603b2897f7bfc3eb
Stack:
:white_circle: #21930 nn.quantized.Relu and nn.quantize.Quantize/DeQuantize modules 💛
:white_circle: #21925 [quant] Add serialization for nn.quantized.Linear module 💛
:black_circle: #21921 Implementation of nn.quantized.linear module 💚
Call FBGEMM kernels to implement quantized linear operator. This operator is used only for inference.
Differential Revision: D15375695