Skip to content

Move rename_tensor to function_hook #136

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 4 commits into from
Mar 15, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions onnx_chainer/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ def backward_postprocess(self, function, in_data, out_grad):
self.converted_nodes[temp_node_name] = nodes

def deleted(self, function=None):
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a brief comment to explain why we need to use deleted?

"""Rename output names.

When renaming an output name, another node can reference the same value
as input, so the input name must be renamed at once. So this renaming
process should be run after all functions are converted and this
`deleted` function is called when function hook is done, means
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 "which means all functions are converted"?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed, thx

completed functions converting.

If input/output name is given by externally, these given names take
Copy link
Member

Choose a reason for hiding this comment

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

Maybe: "names are given externally"

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed, thx

priority over named by this process.
"""
func_name_counts = collections.defaultdict(int)
names = {}
for temp_func_name, nodes in reversed(self.converted_nodes.items()):
Expand Down