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

Conversation

disktnk
Copy link
Member

@disktnk disktnk commented Mar 14, 2019

Move rename_tensor function to FunctionHook.deleted function, to be more customizable.

  • rename output node, using Chainer's FunctionNode name, not ONNX operator name. This change breaks backward compatibility
  • set FunctionNode name as node name
    • along with set doc_string for systematically reason

image

@disktnk disktnk added this to the 1.3.4 milestone Mar 14, 2019
@codecov-io
Copy link

codecov-io commented Mar 14, 2019

Codecov Report

Merging #136 into master will increase coverage by 0.11%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #136      +/-   ##
==========================================
+ Coverage   83.14%   83.25%   +0.11%     
==========================================
  Files          22       22              
  Lines        1127     1135       +8     
==========================================
+ Hits          937      945       +8     
  Misses        190      190
Impacted Files Coverage Δ
onnx_chainer/export.py 91.26% <100%> (+0.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6abd11b...937d6eb. Read the comment docs.

@disktnk
Copy link
Member Author

disktnk commented Mar 15, 2019

If a function is converted nodes are not single, name of intermediate nodes are added "tmp", as FunctionNode_num_tmp_subnum and the last node is named FuncionNode_Number.

image

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.

Great, thanks!

self.graph.extend(nodes)
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?

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

`deleted` function is called when function hook is done, means
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

@disktnk disktnk merged commit f653f92 into chainer:master Mar 15, 2019
@disktnk disktnk deleted the fix/refactor-rename-logic branch March 15, 2019 05:15
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