未验证 提交 d6aeba6f 编写于 作者: G gaotingquan

fix: upgrade replace_sub() to upgrade_sublayer()

supplement to PR #1581
上级 02a083c7
......@@ -19,11 +19,11 @@ class TanhSuffix(paddle.nn.Layer):
def PPLCNet_x2_5_Tanh(pretrained=False, use_ssld=False, **kwargs):
def replace_function(origin_layer):
def replace_function(origin_layer, pattern):
new_layer = TanhSuffix(origin_layer)
return new_layer
match_re = "linear_0"
pattern = "fc"
model = PPLCNet_x2_5(pretrained=pretrained, use_ssld=use_ssld, **kwargs)
model.replace_sub(match_re, replace_function, True)
model.upgrade_sublayer(pattern, replace_function)
return model
......@@ -27,7 +27,7 @@ Arch:
pretrained: True
use_ssld: True
BackboneStopLayer:
name: "flatten_0"
name: "flatten"
Neck:
name: "FC"
embedding_size: 1280
......
......@@ -25,7 +25,7 @@ Arch:
name: MobileNetV1
pretrained: False
BackboneStopLayer:
name: flatten_0
name: "flatten"
Neck:
name: FC
embedding_size: 1024
......
......@@ -34,7 +34,7 @@ Arch:
pretrained: False
use_ssld: True
BackboneStopLayer:
name: flatten_0
name: "flatten"
Neck:
name: FC
embedding_size: 1280
......
......@@ -31,7 +31,7 @@ Arch:
name: "ResNet50_last_stage_stride1"
pretrained: True
BackboneStopLayer:
name: "adaptive_avg_pool2d_0"
name: "avg_pool"
Neck:
name: "VehicleNeck"
in_channels: 2048
......
......@@ -30,7 +30,7 @@ Arch:
name: "ResNet50_last_stage_stride1"
pretrained: True
BackboneStopLayer:
name: "adaptive_avg_pool2d_0"
name: "avg_pool"
Neck:
name: "VehicleNeck"
in_channels: 2048
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册