Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release] 0.2 cherry pick train #872

Merged
merged 6 commits into from
Jun 15, 2022
Merged

Conversation

zou3519
Copy link
Contributor

@zou3519 zou3519 commented Jun 13, 2022

No description provided.

* use decomposition for mse backward

* only reshape if there was no reduction

* add tests, fix shape of mse loss forward

* remove mse xfail

* simplify backwards rule
zou3519 and others added 5 commits June 15, 2022 10:38
These tests are expected to fail, but we didn't communicate that very
well and:
1. we have gotten multiple questions about them
2. we need to special case it in our CI
3. we don't even use the test anymore!

So we are deleting it.

Related: #835
…849)

Fixes #847

We do not allow users to call requires_grad_() inside a functorch
transform. This is because the user is effectively saying
"hey, I want another layer of autograd if I call requires_grad_()", but
that doesn't actually work because to set up a layer of autograd we need
to do some work (e.g. push autograd onto the DynamicLayerStack).

Instead, when a user calls requires_grad_() (and similarly retain_grad),
we raise a nice error message.

This has the intended consequence of causing
torch.autograd.functional.{jvp, vjp, jacobian} to error out when called
inside of a functorch transform. Users should use the functorch
equivalent.

Test Plan:
- added tests
Test Plan:
- run existing tests; code reading
Fixes #859

Start reading at `NOTE: [advanced indexing (index.Tensor) batch rule]`
in the code for details. This PR rewrites the index.Tensor and index_put
batching rules.

The TL;DR is:
- advanced indexing has different behavior depending on if the "advanced
indices are adjacent":
https://numpy.org/doc/stable/user/basics.indexing.html#combining-advanced-and-basic-indexing
- we have to take this into account in our batching rules, because
index.Tensor and index_put handle these internally.

Test Plan
- I added new test cases for getitem and aten.ops.index_put via OpInfo
testing.

Future
- primtorch should have a sane decomposition that we can use
- We haven't fixed the index_put_ batching rule yet. TODO later...
- Upstream our test cases (see next section) into pytorch/pytorch
@zou3519 zou3519 force-pushed the release_0_2_cherry_pick_train branch from fac1d44 to 6d3f6e1 Compare June 15, 2022 17:39
@zou3519 zou3519 merged commit 0c37793 into release/0.2 Jun 15, 2022
zou3519 added a commit that referenced this pull request Jun 15, 2022
zou3519 added a commit that referenced this pull request Jun 15, 2022
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