Skip to content

Conversation

dzhulgakov
Copy link
Collaborator

It's useful if we add additional attributed to nodes in the graph - it's easier to set the attribute on all nodes, even if the value would happen to be None.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@dzhulgakov has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Collaborator

@jamesr66a jamesr66a left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@jamesr66a jamesr66a Aug 21, 2020

Choose a reason for hiding this comment

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

Would be nice to have these commented like the other methods (I see create_arg slipped through as well)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't really know what much to say about them :) also why those are comments and not docstrings?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You would describe when you would call these methods, the arguments and types, etc. They can be docstrings if you want

@dr-ci
Copy link

dr-ci bot commented Aug 22, 2020

💊 CI failures summary and remediations

As of commit 504d6ad (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

Extra GitHub checks: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 25 times.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@dzhulgakov has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@dzhulgakov has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@dzhulgakov has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@jerryzh168 jerryzh168 Aug 25, 2020

Choose a reason for hiding this comment

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

can we keep these helper functions? passing raw strings for op type doesn't sound great.
or should we always create node through delegate now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, it's then easy to mix up delegate vs regular creation. Also, why placeholder and get_param but not others like call_module?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, it's then easy to mix up delegate vs regular creation.

so is delegate the suggested API for creating nodes?

Also, why placeholder and get_param but not others like call_module?

I was planning to add helper functions for other node types as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Node creation should always go through a delegate and the delegate should be specifiable by the caller of the pass. Otherwise, we will lose composability, for example if I want to run a pipeline of passes on a Module but I want custom leaf modules

I might go so far as to say we should make create_node private, or move it into Delegate itself to make Graph just a dumb container for nodes

Copy link
Contributor

Choose a reason for hiding this comment

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

always enforcing people to use delegate sounds good, are you planning to do it? I still have some prs on quantization, feel free to change all the other call sites of create_node first and I can have a PR to make create_node private and change quantization call sites.

Summary:
It's useful if we add additional attributed to nodes in the graph - it's easier to set the attribute on all nodes, even if the value would happen to be None.

Pull Request resolved: pytorch#43432

Reviewed By: jamesr66a

Differential Revision: D23276433

Pulled By: dzhulgakov

fbshipit-source-id: 11b3f452e7fe859c5d6c861ff42cd326dd3b66c0
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D23276433

@codecov
Copy link

codecov bot commented Aug 28, 2020

Codecov Report

Merging #43432 into master will decrease coverage by 19.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #43432       +/-   ##
===========================================
- Coverage   69.34%   50.32%   -19.02%     
===========================================
  Files         378      378               
  Lines       46700    46700               
===========================================
- Hits        32382    23502     -8880     
- Misses      14318    23198     +8880     
Impacted Files Coverage Δ
torch/fx/graph.py 97.74% <ø> (-0.07%) ⬇️
torch/fx/symbolic_trace.py 93.40% <100.00%> (+0.30%) ⬆️
torch/quantization/fx/quantize.py 93.16% <100.00%> (ø)
torch/cuda/comm.py 0.00% <0.00%> (-100.00%) ⬇️
torch/utils/dlpack.py 0.00% <0.00%> (-100.00%) ⬇️
torch/nn/backends/thnn.py 0.00% <0.00%> (-100.00%) ⬇️
torch/utils/ffi/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
torch/utils/tensorboard/_utils.py 0.00% <0.00%> (-100.00%) ⬇️
torch/utils/_benchmark/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
torch/utils/tensorboard/_embedding.py 0.00% <0.00%> (-100.00%) ⬇️
... and 167 more

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 dc5d365...504d6ad. Read the comment docs.

@facebook-github-bot
Copy link
Contributor

@dzhulgakov merged this pull request in 633d239.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants