Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
507595b0
Unverified
Commit
507595b0
authored
Jul 08, 2021
by
lin bin
Committed by
GitHub
Jul 08, 2021
Browse files
add bias to be aligned with paper (#3904)
parent
64cf397c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
11 deletions
+0
-11
nni/algorithms/compression/pytorch/quantization/quantizers.py
...algorithms/compression/pytorch/quantization/quantizers.py
+0
-11
No files found.
nni/algorithms/compression/pytorch/quantization/quantizers.py
View file @
507595b0
...
...
@@ -265,17 +265,6 @@ class QAT_Quantizer(Quantizer):
module
.
tracked_max_input
=
update_ema
(
module
.
tracked_max_input
,
current_max
,
module
.
ema_decay
)
# if bias exists, quantize bias to uint32
if
hasattr
(
wrapper
.
module
,
'bias'
)
and
wrapper
.
module
.
bias
is
not
None
:
bias
=
wrapper
.
module
.
bias
.
data
bias_bits
=
32
rmin
,
rmax
=
torch
.
min
(
bias
),
torch
.
max
(
bias
)
module
.
scale
,
module
.
zero_point
=
update_quantization_param
(
bias_bits
,
rmin
,
rmax
)
bias
=
self
.
_quantize
(
bias_bits
,
module
,
bias
)
bias
=
self
.
_dequantize
(
module
,
bias
)
wrapper
.
module
.
bias
.
data
=
bias
# quantize weight
rmin
,
rmax
=
torch
.
min
(
weight
),
torch
.
max
(
weight
)
module
.
scale
,
module
.
zero_point
=
update_quantization_param
(
weight_bits
,
rmin
,
rmax
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment