Skip to content

Implement batching rules for some view ops - #42248

Closed
zou3519 wants to merge 5 commits into
gh/zou3519/275/basefrom
gh/zou3519/275/head
Closed

zou3519 wants to merge 5 commits into
gh/zou3519/275/basefrom
gh/zou3519/275/head

Conversation

@zou3519

@zou3519 zou3519 commented Jul 29, 2020 •

Copy link
Copy Markdown
Contributor

Stack from ghstack:

Including:

  • torch.diagonal
  • torch.t
  • torch.select
  • Tensor.expand_as
  • Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:

  • new tests in test/test_vmap.py.
  • I would like to have a more structured/automated way of testing but
    my previous attempts at making something resulted in something very
    complicated.

Differential Revision: D22846273

Including:
- torch.diagonal
- torch.t
- torch.select
- Tensor.expand_as
- Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:
- new tests in `test/test_vmap.py`.
- I would like to have a more structured/automated way of testing but
my previous attempts at making something resulted in something very
complicated.

[ghstack-poisoned]
@zou3519 zou3519 mentioned this pull request Jul 29, 2020
zou3519 added a commit that referenced this pull request Jul 29, 2020
Including:
- torch.diagonal
- torch.t
- torch.select
- Tensor.expand_as
- Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:
- new tests in `test/test_vmap.py`.
- I would like to have a more structured/automated way of testing but
my previous attempts at making something resulted in something very
complicated.

ghstack-source-id: bdfe389
Pull Request resolved: #42248
Including:
- torch.diagonal
- torch.t
- torch.select
- Tensor.expand_as
- Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:
- new tests in `test/test_vmap.py`.
- I would like to have a more structured/automated way of testing but
my previous attempts at making something resulted in something very
complicated.

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request Jul 29, 2020
Including:
- torch.diagonal
- torch.t
- torch.select
- Tensor.expand_as
- Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:
- new tests in `test/test_vmap.py`.
- I would like to have a more structured/automated way of testing but
my previous attempts at making something resulted in something very
complicated.

ghstack-source-id: f8883f1
Pull Request resolved: #42248
@zou3519
zou3519 requested review from cpuhrsch and ezyang July 30, 2020 17:45

@ezyang ezyang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, these are simple enough.

Have you considered writing some tests that compare the behavior of your backend fallback with the explicit operator? I don't know how I would wire this up, but that might also be an interesting way to check for correctness.

@zou3519

zou3519 commented Jul 31, 2020

Copy link
Copy Markdown
Contributor Author

Have you considered writing some tests that compare the behavior of your backend fallback with the explicit operator? I don't know how I would wire this up, but that might also be an interesting way to check for correctness.

I have considered that. It would be easier to do if there existed an operator database: given some operator, I'd like to query B0 valid inputs for some shape. Then, I can run the explicit operator on each of those B0 inputs and compare the result to vmap on the stacked B0 tensors. Without an op database I would be writing sample inputs for days. cc @mruberry if any of that helps with the operator database work

zou3519 added 2 commits July 31, 2020 08:49
Including:
- torch.diagonal
- torch.t
- torch.select
- Tensor.expand_as
- Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:
- new tests in `test/test_vmap.py`.
- I would like to have a more structured/automated way of testing but
my previous attempts at making something resulted in something very
complicated.

Differential Revision: [D22846273](https://our.internmc.facebook.com/intern/diff/D22846273)

[ghstack-poisoned]
Including:
- torch.diagonal
- torch.t
- torch.select
- Tensor.expand_as
- Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:
- new tests in `test/test_vmap.py`.
- I would like to have a more structured/automated way of testing but
my previous attempts at making something resulted in something very
complicated.

Differential Revision: [D22846273](https://our.internmc.facebook.com/intern/diff/D22846273)

[ghstack-poisoned]
@dr-ci

dr-ci Bot commented Jul 31, 2020 •

Copy link
Copy Markdown

💊 CI failures summary and remediations

As of commit 641acc1 (more details on the Dr. CI page):


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


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 3 times.

Including:
- torch.diagonal
- torch.t
- torch.select
- Tensor.expand_as
- Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:
- new tests in `test/test_vmap.py`.
- I would like to have a more structured/automated way of testing but
my previous attempts at making something resulted in something very
complicated.

Differential Revision: [D22846273](https://our.internmc.facebook.com/intern/diff/D22846273)

[ghstack-poisoned]
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@zou3519 merged this pull request in 4cdbe5c.

@facebook-github-bot
facebook-github-bot deleted the gh/zou3519/275/head branch August 7, 2020 14:26
MauiDesign pushed a commit to MauiDesign/PyTorchPyTorch that referenced this pull request Aug 16, 2020
Including:
- torch.diagonal
- torch.t
- torch.select
- Tensor.expand_as
- Tensor slicing.

Please let me know in the future if it would be easier to review these
separately (I put five operators into this PR because each
implementation is relatively simple).

Test Plan:
- new tests in `test/test_vmap.py`.
- I would like to have a more structured/automated way of testing but
my previous attempts at making something resulted in something very
complicated.

ghstack-source-id: 125529e
Pull Request resolved: pytorch/pytorch#42248
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.

4 participants