提交 a6238512 编写于 作者: G gaotingquan 提交者: Tingquan Gao

fix: defer update_res() calling until after the object's __init__ has completed execution

上级 316479d3
......@@ -77,7 +77,11 @@ class TheseusLayer(nn.Layer):
return_patterns = [stages_pattern[i] for i in return_stages]
if return_patterns:
self.update_res(return_patterns)
# call update_res function after the __init__ of the object has completed execution, that is, the contructing of layer or model has been completed.
def update_res_hook(layer, input):
self.update_res(return_patterns)
self.register_forward_pre_hook(update_res_hook)
# freeze subnet
if freeze_befor is not None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册