Skip to content

Commit

Permalink
Add bias for fx_model (#1447)
Browse files Browse the repository at this point in the history
Signed-off-by: Tang, Kaihui <[email protected]>
Co-authored-by: chen, suyue <[email protected]>
  • Loading branch information
Kaihui-intel and chensuyue authored Dec 12, 2023
1 parent c741b89 commit 7f53d16
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions neural_compressor/adaptor/torch_utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ def append_attr(fx_model, model, fx_white_list=[]):
fx_model.weight = fx_model.module.weight()
else:
fx_model.weight = fx_model.module.weight
if hasattr(fx_model.module, "bias"):
if not isinstance(fx_model.module.bias, torch.Tensor) and fx_model.module.bias is not None:
fx_model.bias = fx_model.module.bias()
else:
fx_model.bias = fx_model.module.bias
for i in org_attr:
if (
type(model) in fx_white_list
Expand Down

0 comments on commit 7f53d16

Please sign in to comment.