Skip to content

Improve the naming of values #118

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

Merged
merged 6 commits into from
Mar 4, 2019
Merged

Improve the naming of values #118

merged 6 commits into from
Mar 4, 2019

Conversation

ir5
Copy link
Contributor

@ir5 ir5 commented Mar 1, 2019

Currently, str(id(v)) is used for naming values. This is not human-readable. This PR introduces a new class Context, which can provide a human-readable naming for values. This PR replaces all the occurrences of str(id(...)) with the call of Context class.
I expect that Context can contain some additional information such as parameters. This may slightly simplify the interface of implementation.

Copy link
Member

@shinh shinh left a comment

Choose a reason for hiding this comment

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

I think we can add more features to Context, but further improvement can be done in separate PRs and this PR already makes onnx-chainer better. LGTM

class Context(object):

def __init__(self, model):
self.namedparams = dict()
Copy link
Member

Choose a reason for hiding this comment

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

How about removing self.namedparams and just use self.name_list even for parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It sounds reasonable. I would change the code.

@disktnk disktnk added this to the 1.3.3 milestone Mar 1, 2019
@disktnk disktnk self-requested a review March 4, 2019 01:38
Copy link
Member

@disktnk disktnk left a comment

Choose a reason for hiding this comment

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

LGTM!

ONNX IR force naming rule to be "C identifier syntax rules" (ref), however current name got by object ID is invalid neither, we will address with it later. Thanks!

@disktnk disktnk merged commit 8c52b77 into chainer:master Mar 4, 2019
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.

3 participants