Skip to content

Conversation

@duc0
Copy link
Contributor

@duc0 duc0 commented Jul 31, 2018

Summary:
Add new utility that make it easier to write graph transformation. Callers now only need to take care of the actual transformation logic. The subgraph matching is simplified because callers only need to specify a simple construct for subtree matching criteria.

The utlity is SubgraphMatcher::replaceSubtree

Some notes:

  • replaceSubtree takes a subtree matching criteria, and a lambda that takes a subtree root. It does't not handle any transformations itself. Callers should be responsible for the transformation part, including deleting all nodes in the matched subtree(s). We could enhance this to also handle the deletion part if it turns out to be useful.
  • Only sub tree matching is supported for now but we can add general DAG sub-graph support later if needed.

Differential Revision: D9073297

@duc0 duc0 force-pushed the export-D9073297 branch from 912e5eb to 8a4aeca Compare July 31, 2018 23:28
@duc0 duc0 force-pushed the export-D9073297 branch from 8a4aeca to 8ecddc4 Compare July 31, 2018 23:32
@duc0 duc0 force-pushed the export-D9073297 branch from 8ecddc4 to c9c11ac Compare July 31, 2018 23:40
@duc0 duc0 force-pushed the export-D9073297 branch from c9c11ac to b605393 Compare August 1, 2018 01:30
@duc0 duc0 force-pushed the export-D9073297 branch from b605393 to 9e82541 Compare August 1, 2018 18:20
@duc0 duc0 force-pushed the export-D9073297 branch from 9e82541 to e7c22fd Compare August 1, 2018 18:23
Summary:
Pull Request resolved: pytorch#10081

Add new utility that make it easier to write graph transformation. Callers now only need to take care of the actual transformation logic. The subgraph matching is simplified because callers only need to specify a simple construct for subtree matching criteria.

The utlity is SubgraphMatcher::replaceSubtree

Some notes:
- replaceSubtree takes a subtree matching criteria, and a lambda that takes a subtree root. It does't not handle any transformations itself. Callers should be responsible for the transformation part, including deleting all nodes in the matched subtree(s). We could enhance this to also handle the deletion part if it turns out to be useful.
- Only sub tree matching is supported for now but we can add general DAG sub-graph support later if needed.

Reviewed By: bwasti

Differential Revision: D9073297

fbshipit-source-id: 4fe7225dcc0e9a0db8dc94c810acb9122bee9a47
@duc0 duc0 force-pushed the export-D9073297 branch from e7c22fd to 817c2f0 Compare August 2, 2018 05:07
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
Pull Request resolved: pytorch#10081

Add new utility that make it easier to write graph transformation. Callers now only need to take care of the actual transformation logic. The subgraph matching is simplified because callers only need to specify a simple construct for subtree matching criteria.

The utlity is SubgraphMatcher::replaceSubtree

Some notes:
- replaceSubtree takes a subtree matching criteria, and a lambda that takes a subtree root. It does't not handle any transformations itself. Callers should be responsible for the transformation part, including deleting all nodes in the matched subtree(s). We could enhance this to also handle the deletion part if it turns out to be useful.
- Only sub tree matching is supported for now but we can add general DAG sub-graph support later if needed.

Reviewed By: bwasti

Differential Revision: D9073297

fbshipit-source-id: 465a0ad11caafde01196fbb2eda2d4d8e550c3b6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants