Skip to content

Conversation

@qingqing01
Copy link
Contributor

@qingqing01 qingqing01 commented Jun 29, 2017

Fix #2663

The usage example is:

para = paddle.parameters.create(cost) para.init_from_tar('init_params.tar.gz') 
@qingqing01 qingqing01 requested review from NHZlX, pkuyym and reyoung June 29, 2017 02:20
(shape, value.shape))

if len(self.__gradient_machines__) == 0:
self.__tmp_params__.append((key, value))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The append could lead the repeated key in self.__tmp_params__. This is a bug.

Copy link
Collaborator

@reyoung reyoung left a comment

Choose a reason for hiding this comment

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

LGTM, except a tiny enhancement for Python syntax.

params.deserialize(param_name, f)
return params

def init_from_tar(self, f):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Because from_tar is a static method. Maybe Parameters.from_tar is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@pkuyym pkuyym left a comment

Choose a reason for hiding this comment

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

Maybe we should add comment to describe the usage scenario about from_tar and init_from_tar.

@qingqing01
Copy link
Contributor Author

@pkuyym add comments.

@NHZlX
Copy link
Contributor

NHZlX commented Jul 1, 2017

The usage example should be :

para = paddle.parameters.create(cost) with gzip.open('init_params.tar.gz') as f: para.init_from_tar(f) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants