From 952726a4a1b07c2dfd49acfdab611b9f2a4b2196 Mon Sep 17 00:00:00 2001 From: wjj19950828 Date: Tue, 26 Apr 2022 11:09:58 +0800 Subject: [PATCH] fixed fc fuser --- x2paddle/optimizer/fusion/trace_fc_fuser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x2paddle/optimizer/fusion/trace_fc_fuser.py b/x2paddle/optimizer/fusion/trace_fc_fuser.py index dc752ec..cd2a977 100644 --- a/x2paddle/optimizer/fusion/trace_fc_fuser.py +++ b/x2paddle/optimizer/fusion/trace_fc_fuser.py @@ -113,10 +113,11 @@ class TraceFcFuser(FuseBase): attrs["out_features"] = parameters[weight_name].shape[0] linear_name = "linear{}".format(self.linear_index) self.linear_index += 1 - parameters["{}.weight".format(linear_name)] = parameters[ - weight_name].transpose((1, 0)) - parameters["{}.bias".format(linear_name)] = np.squeeze(parameters[ - bias_name]) + weight_numpy = parameters.pop(weight_name) + parameters["{}.weight".format(linear_name)] = weight_numpy.transpose( + (1, 0)) + bias_numpy = parameters.pop(bias_name) + parameters["{}.bias".format(linear_name)] = np.squeeze(bias_numpy) new_layer = PaddleLayer( layers_id[0], "paddle.nn.Linear", -- GitLab