Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 API save and load param header #3619

Closed
wants to merge 4 commits into from
Closed

V2 API save and load param header #3619

wants to merge 4 commits into from

Conversation

luotao1
Copy link
Contributor

@luotao1 luotao1 commented Aug 22, 2017

related #3571
fix #3519

Test successfully on book/01.fit_a_line.

Copy link
Contributor

@tensor-tang tensor-tang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有点疑问,请帮忙解答下

@@ -34,7 +34,7 @@ def __init__(self, output_layer, parameters):
val = param.getBuf(api.PARAMETER_VALUE)
name = param.getName()
assert isinstance(val, api.Vector)
val.copyFromNumpyArray(parameters.get(name).flatten())
val.copyFromNumpyArray(parameters.get(name)[1].flatten())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么需要改动inference的code?那么Training的时候也需要改吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为原来:value = parameter.get(name)
现在:header, value = parameter.get(name)
Training的时候,改在parameters.py里面了

@@ -43,7 +43,7 @@ def test_serialization(self):
params.__append_config__(__rand_param_config__("param_1"))

for name in params.names():
param = params.get(name)
param = params.get(name)[1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里只测试了[1],有没有办法也测试[0]的值?代表的是header的值对吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[0]代表header的值。这里header默认都是0,所以都没做测试。可以等以后mkldnn的header进来,再另加一个单测。

@tensor-tang
Copy link
Contributor

在我本地机器上测试了下。
用mkldnn_fc 跑了个简单网络,保存的param中header为1。

LGTM

@luotao1 luotao1 closed this Jul 10, 2018
@luotao1 luotao1 deleted the header branch August 23, 2018 11:25
heavengate pushed a commit to heavengate/Paddle that referenced this pull request Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Parameter Header in V2 API
2 participants