Skip to content

Implement batching rules for some unary ops#43059

Closed
zou3519 wants to merge 5 commits intogh/zou3519/287/basefrom
gh/zou3519/287/head
Closed

Implement batching rules for some unary ops#43059
zou3519 wants to merge 5 commits intogh/zou3519/287/basefrom
gh/zou3519/287/head

Conversation

@zou3519
Copy link
Copy Markdown
Contributor

@zou3519 zou3519 commented Aug 14, 2020

Stack from ghstack:

This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:

  • new tests pytest test/test_vmap.py -v -k "Operators"

Differential Revision: D23132277

This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:
- new tests `pytest test/test_vmap.py -v -k "Operators"`

[ghstack-poisoned]
This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:
- new tests `pytest test/test_vmap.py -v -k "Operators"`

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

[ghstack-poisoned]
This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:
- new tests `pytest test/test_vmap.py -v -k "Operators"`

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

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request Aug 14, 2020
This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:
- new tests `pytest test/test_vmap.py -v -k "Operators"`

ghstack-source-id: c405ffd
Pull Request resolved: #43059
@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented Aug 14, 2020

💊 CI failures summary and remediations

As of commit 30a25d7 (more details on the Dr. CI page):


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

ci.pytorch.org: 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 8 times.

@zou3519 zou3519 requested review from cpuhrsch and ezyang August 14, 2020 17:02
This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:
- new tests `pytest test/test_vmap.py -v -k "Operators"`

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

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request Aug 17, 2020
This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:
- new tests `pytest test/test_vmap.py -v -k "Operators"`

ghstack-source-id: 25f9790
Pull Request resolved: #43059
This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:
- new tests `pytest test/test_vmap.py -v -k "Operators"`

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

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request Aug 17, 2020
This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan:
- new tests `pytest test/test_vmap.py -v -k "Operators"`

ghstack-source-id: 0aeb012
Pull Request resolved: #43059
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@zou3519 merged this pull request in 37252e8.

1 similar comment
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@zou3519 merged this pull request in 37252e8.

@facebook-github-bot facebook-github-bot deleted the gh/zou3519/287/head branch August 21, 2020 14:16
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Pull Request resolved: pytorch#43059

This PR implements batching rules for some unary ops. In particular, it
implements the batching rules for the unary ops that take a single
tensor as input (and nothing else).

The batching rule for a unary op is:
(1) grab the physical tensor straight out of the BatchedTensor
(2) call the unary op
(3) rewrap the physical tensor in a BatchedTensor

Test Plan: - new tests `pytest test/test_vmap.py -v -k "Operators"`

Reviewed By: ezyang

Differential Revision: D23132277

Pulled By: zou3519

fbshipit-source-id: 24b9d7535338207531d767155cdefd2c373ada77
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