未验证 提交 7586ce45 编写于 作者: B Bai Yifan 提交者: GitHub

fix hardsigmoid/hardswish (#607) (#628)

上级 2830c0ff
...@@ -213,7 +213,7 @@ class ConvBNLayer(nn.Layer): ...@@ -213,7 +213,7 @@ class ConvBNLayer(nn.Layer):
if self.act == "relu": if self.act == "relu":
x = F.relu(x) x = F.relu(x)
elif self.act == "hard_swish": elif self.act == "hard_swish":
x = hard_swish(x) x = paddle.nn.functional.activation.hardswish(x)
else: else:
print("The activation function is selected incorrectly.") print("The activation function is selected incorrectly.")
exit() exit()
......
...@@ -235,6 +235,8 @@ class QAT(object): ...@@ -235,6 +235,8 @@ class QAT(object):
quantizable_layer_type=self.config['quantizable_layer_type']) quantizable_layer_type=self.config['quantizable_layer_type'])
with paddle.utils.unique_name.guard(): with paddle.utils.unique_name.guard():
if hasattr(model, "_layers"):
model = model._layers
model.__init__() model.__init__()
self.imperative_qat.quantize(model) self.imperative_qat.quantize(model)
state_dict = model.state_dict() state_dict = model.state_dict()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册