Skip to content

Add new ways of matching nodes with schemas in the JIT#9567

Closed
apaszke wants to merge 2 commits intopytorch:masterfrom
apaszke:jit_pattern_match
Closed

Add new ways of matching nodes with schemas in the JIT#9567
apaszke wants to merge 2 commits intopytorch:masterfrom
apaszke:jit_pattern_match

Conversation

@apaszke
Copy link
Contributor

@apaszke apaszke commented Jul 18, 2018

REVIEW LAST COMMIT ONLY

As discussed in our yesterday's meeting. Nodes can be now matched to particular overloads using the matches(...) function:

n->matches("aten::type_as(Tensor self, Tensor other) -> Tensor")

This also changes the shape prop and peephole passes to use those functions for matching. This fixes a few bugs, makes them much more robust, and prepares us for removal of attributes.

@zdevito

Copy link
Contributor

@zdevito zdevito left a comment

Choose a reason for hiding this comment

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

I have some suggestions but this generally looks good. We should try to find ways to make obtaining constant values more concise because the n->get<type>(attr).value() pattern is pretty verbose.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@apaszke apaszke force-pushed the jit_pattern_match branch from ee9c001 to 4bb4044 Compare July 20, 2018 18:11
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.

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

zdevito pushed a commit to zdevito/ATen that referenced this pull request Jul 22, 2018
Summary:
**REVIEW LAST COMMIT ONLY**

As discussed in our yesterday's meeting. Nodes can be now matched to particular overloads using the `matches(...)` function:
```cpp
n->matches("aten::type_as(Tensor self, Tensor other) -> Tensor")
```

This also changes the shape prop and peephole passes to use those functions for matching. This fixes a few bugs, makes them much more robust, and prepares us for removal of attributes.

zdevito
Pull Request resolved: pytorch/pytorch#9567

Reviewed By: zdevito

Differential Revision: D8938482

Pulled By: apaszke

fbshipit-source-id: eb2382eeeae99692aada2d78d5d0c87c8ef1545e
@ezyang
Copy link
Contributor

ezyang commented Jul 22, 2018

Hey @apaszke, does this error message ring a bell for you?

RuntimeError: 
Schema not found for node. File a bug report.
Node: %277 : Float(4!, 7128) = aten::expand[size=[4, 7128], implicit=1](%52), scope: MultiTaskModel/Sequential/Linear[1]
Input types:Float(7128)
candidates were:
:
torch/nn/functional.py(1024): linear
torch/nn/modules/linear.py(55): forward
torch/nn/modules/module.py(465): _slow_forward
torch/nn/modules/module.py(475): __call__
torch/nn/modules/container.py(91): forward
torch/nn/modules/module.py(465): _slow_forward
torch/nn/modules/mo

jramseyer pushed a commit to jramseyer/pytorch that referenced this pull request Jul 30, 2018
Summary:
**REVIEW LAST COMMIT ONLY**

As discussed in our yesterday's meeting. Nodes can be now matched to particular overloads using the `matches(...)` function:
```cpp
n->matches("aten::type_as(Tensor self, Tensor other) -> Tensor")
```

This also changes the shape prop and peephole passes to use those functions for matching. This fixes a few bugs, makes them much more robust, and prepares us for removal of attributes.

zdevito
Pull Request resolved: pytorch#9567

Reviewed By: zdevito

Differential Revision: D8938482

Pulled By: apaszke

fbshipit-source-id: eb2382eeeae99692aada2d78d5d0c87c8ef1545e
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
**REVIEW LAST COMMIT ONLY**

As discussed in our yesterday's meeting. Nodes can be now matched to particular overloads using the `matches(...)` function:
```cpp
n->matches("aten::type_as(Tensor self, Tensor other) -> Tensor")
```

This also changes the shape prop and peephole passes to use those functions for matching. This fixes a few bugs, makes them much more robust, and prepares us for removal of attributes.

zdevito
Pull Request resolved: pytorch#9567

Reviewed By: zdevito

Differential Revision: D8938482

Pulled By: apaszke

fbshipit-source-id: eb2382eeeae99692aada2d78d5d0c87c8ef1545e
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.

4 participants