Skip to content

Commit 7f53d16

Browse files
Add bias for fx_model (#1447)
Signed-off-by: Tang, Kaihui <kaihui.tang@intel.com> Co-authored-by: chen, suyue <suyue.chen@intel.com>
1 parent c741b89 commit 7f53d16

File tree

1 file changed

+5
-0
lines changed
  • neural_compressor/adaptor/torch_utils

1 file changed

+5
-0
lines changed

neural_compressor/adaptor/torch_utils/util.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ def append_attr(fx_model, model, fx_white_list=[]):
184184
fx_model.weight = fx_model.module.weight()
185185
else:
186186
fx_model.weight = fx_model.module.weight
187+
if hasattr(fx_model.module, "bias"):
188+
if not isinstance(fx_model.module.bias, torch.Tensor) and fx_model.module.bias is not None:
189+
fx_model.bias = fx_model.module.bias()
190+
else:
191+
fx_model.bias = fx_model.module.bias
187192
for i in org_attr:
188193
if (
189194
type(model) in fx_white_list

0 commit comments

Comments
 (0)