Skip to content

refactor op handling to use register pattern#78523

Closed
eellison wants to merge 18 commits intogh/eellison/301/basefrom
gh/eellison/301/head
Closed

refactor op handling to use register pattern#78523
eellison wants to merge 18 commits intogh/eellison/301/basefrom
gh/eellison/301/head

Conversation

@eellison
Copy link
Contributor

@eellison eellison commented May 31, 2022

Stack from ghstack (oldest at bottom):

Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation.

@register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):

is short-hand for

@register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented May 31, 2022

🔗 Helpful links

✅ No Failures (0 Pending)

As of commit 607ec34 (more details on the Dr. CI page):

Expand to see more

💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@eellison eellison mentioned this pull request May 31, 2022
eellison added 2 commits May 31, 2022 09:49
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
@eellison eellison requested a review from ezyang May 31, 2022 17:40
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
@eellison eellison closed this Jun 1, 2022
@eellison eellison reopened this Jun 2, 2022
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
eellison added a commit that referenced this pull request Jun 2, 2022
ghstack-source-id: 1d66461
Pull Request resolved: #78523
@eellison eellison requested a review from samdow June 2, 2022 22:37
Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

sure why not

Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
eellison added 9 commits June 7, 2022 09:16
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
Cleans up the operators that require special handling by registering a function which returns if the operator implementation should run, and a corresponding operator implementation. 

```
register_op_handler(torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```
is short-hand for
```
register_op_handler(lambda func: func == torch.ops.aten._to_copy.default)
def to_copy(cls_or_mode_instance, func, types, args, kwargs, run_function, converter):
```


[ghstack-poisoned]
@eellison
Copy link
Contributor Author

eellison commented Jun 8, 2022

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2022

Hey @eellison.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

ezyang pushed a commit to ezyang/pytorch that referenced this pull request Jun 9, 2022
ghstack-source-id: 7058d8b
Pull Request resolved: pytorch#78523
facebook-github-bot pushed a commit that referenced this pull request Jun 10, 2022
Summary:
Pull Request resolved: #78523

Approved by: https://github.com/ezyang

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/d6ecdf16056e907deca2a0e8927fef30051f105f

Reviewed By: osalpekar

Differential Revision: D37025746

Pulled By: eellison

fbshipit-source-id: 99c84d6666d0f3d77cb6353c8979f08ab2cf924f
@facebook-github-bot facebook-github-bot deleted the gh/eellison/301/head branch June 12, 2022 14:20
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