Commit Graph

217 Commits

Author SHA1 Message Date
lezcano
11fe277b62 [PrimTorch] Add reference for torch.norm (#81765)
This ref does more things than `torch.norm`, and it fixes a few bugs
that `torch.norm` has. This implementation and the `torch.norm`
implementation come to terms in the next PR of this stack

We put this PR before, as otherwise `test_decomp.py` was failing.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81765
Approved by: https://github.com/ngimel
2022-07-25 19:57:21 +00:00
Mostafa Elhoushi
0894c4967d Add test_make_fx_model_train example (#980) (#82011)
Summary: Pull Request resolved: https://github.com/pytorch/functorch/pull/980

Test Plan: CI should pass

Differential Revision: D38078694

Pulled By: mostafaelhoushi

Pull Request resolved: https://github.com/pytorch/pytorch/pull/82011
Approved by: https://github.com/Chillee
2022-07-25 12:43:17 +00:00
Horace He
1a18ff3247 Revert "Revert "Added dynamic shape POC (#81093)"" (#82063)
This reverts commit 0888a4844c.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82063
Approved by: https://github.com/ezyang
2022-07-23 22:35:50 +00:00
PyTorch MergeBot
0888a4844c Revert "Added dynamic shape POC (#81093)"
This reverts commit 8169a85dc6.

Reverted https://github.com/pytorch/pytorch/pull/81093 on behalf of https://github.com/janeyx99 due to Broke slow tests on trunk 8169a85dc6.
2022-07-23 11:30:37 +00:00
Horace He
8169a85dc6 Added dynamic shape POC (#81093)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81093
Approved by: https://github.com/ezyang, https://github.com/eellison
2022-07-23 04:46:32 +00:00
PyTorch MergeBot
521d5ae1ce Revert "Enable reentrant dispatch for decompositions (#81598)"
This reverts commit 08b9544e1c.

Reverted https://github.com/pytorch/pytorch/pull/81598 on behalf of https://github.com/ezyang due to out of tree failures
2022-07-22 00:21:18 +00:00
Edward Z. Yang
5b88a2078b Follow GitHub relabeling of oncall: fx for test owners (#81821)
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81821
Approved by: https://github.com/janeyx99
2022-07-21 01:50:06 +00:00
David Berard
08b9544e1c Enable reentrant dispatch for decompositions (#81598)
This allows us to avoid tracing through CompositeImplicitAutograd ops
when decomposing via make_fx or other decomposition methods that use
tracing.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81598
Approved by: https://github.com/ezyang
2022-07-20 21:26:16 +00:00
Edward Z. Yang
fca03eeec1 Make proxy tensor support item() calls on torch.tensor constants (#81192)
This PR is doing a few interrelated things, all of which are necessary to get correctness. Read the comment in torch/fx/experimental/proxy_tensor.py for the high level overview.

Let's break down the parts of this PR:

* Bug fix where `enable_torch_dispatch_mode` with `None` doesn't work. This make `enable_torch_dispatch_mode(current_mode.inner)` work which is the basis for how we temporarily disable fake tensor mode.
* Bug fix for when fake tensor mode is combined with a non-mode tensor subclass. This actually could be ablated from this PR but it affects where the logic for allowing non fake tensor inputs with lift goes, so it's all in here in one go. There are some relevant tests for the fix in fake tensor, but it turns out I didn't need this because I'm always using proxy tensors as a mode (which ensures the ordering is right.)
* New `lift_fresh` view operator.  Note that like lift, we have to manually write the functionalize kernel for these functions.
* The actual change, which is to save constants when we see them in the proxy tensor mode, and then propagate them as we go (because otherwise you'll handle mutations on constants incorrectly--see test.)

This is mildly BC-breaking if anyone was previously interposing on
at::lift, but this operator was relatively new and I checked
functorch which has no explicit reference to lift.  So I think it
should not be too disruptive.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81192
Approved by: https://github.com/samdow, https://github.com/bdhirsh
2022-07-15 03:53:40 +00:00
Horace He
b7046e9b7f Stopped ProxyTensor from turning aten::lift tensors into proxy objects (#81024)
```
def f():
    val = torch.tensor(float('inf'))
    return torch.full((100, 100), val)
```
today we turn `val` into a ProxyTensor, and then complain when we try to turn `val` into a scalar.

We call `aten::lift` when we call `torch.tensor(5)`, so this just prevents those from being turned into ProxyTensors unnecessarily.

cc: @ezyang
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81024
Approved by: https://github.com/ezyang
2022-07-07 04:54:31 +00:00
David Berard
00f651811a Interpreter for decomposing aten -> prims (#79989)
If an aten -> prim decomposition is needed *after* the initial trace
with make_fx, this interpreter can be used to perform the decomposition.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79989
Approved by: https://github.com/SherlockNoMad
2022-06-29 21:16:28 +00:00
Horace He
615dd25088 Made Proxy Tensor Mode also trace overloads (#80403)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80403
Approved by: https://github.com/zou3519
2022-06-28 04:31:43 +00:00
PyTorch MergeBot
4e33c8c6bb switched over to using faketensor in proxytensor (#79634)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79634
Approved by: https://github.com/albanD
2022-06-27 19:55:47 +00:00
Horace He
159d459c50 Switched to tracing overloads by default (#80013)
There are many cases where it's more convenient to use overloads, but we've hesitated in doing so since we can't torchscript it directly.

Luckily, it's pretty easy to strip overloads. See https://github.com/pytorch/functorch/pull/899
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80013
Approved by: https://github.com/zou3519
2022-06-22 18:55:06 +00:00
Peter Bell
9bf52f4be8 Add OpInfo for torch.equal and fix support for non-standard bools
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79389

Approved by: https://github.com/mruberry
2022-06-20 23:48:39 +00:00
Horace He
f5d7e5a192 started using mode-based tracing
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79638

Approved by: https://github.com/samdow
2022-06-17 20:24:49 +00:00
Horace He
4d88affb5d Ported proxy tensor tests over to core (#78890)
Will fill out later
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78890
Approved by: https://github.com/ezyang, https://github.com/zou3519
2022-06-07 00:28:53 +00:00