Commit Graph

46435 Commits

Author SHA1 Message Date
PyTorch MergeBot
d8b80edade Revert "Use weakref.proxy when saving module to internal dictionaries to not increase refcount (#76435)"
This reverts commit 1aa3cbb83b.

Reverted https://github.com/pytorch/pytorch/pull/76435 on behalf of https://github.com/jbschlosser
2022-05-17 17:51:26 +00:00
Sadra Barikbin
71d61bb78b Fix typo in torch.package code and docs (#77604)
Fixes #77603

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77604
Approved by: https://github.com/cpuhrsch
2022-05-17 17:35:39 +00:00
mingfeima
c003494754 add channels last support for PixelShuffle and PixelUnshuffle
Pull Request resolved: https://github.com/pytorch/pytorch/pull/50573

Approved by: https://github.com/VitalyFedyunin
2022-05-17 17:33:49 +00:00
Brian Hirsh
cfc87cad02 fix grad(torch.tensor()) using lift() operator
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77650

Approved by: https://github.com/zou3519
2022-05-17 16:55:37 +00:00
ecao
541a378914 Remove operators that support BFloat16 in the fp32 cast policy list of AutocastCPU (#77623)
Remove operators that support BFloat16 in the fp32 cast policy list of AutocastCPU.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77623
Approved by: https://github.com/frank-wei
2022-05-17 16:49:17 +00:00
Pearu Peterson
dc882ed33d Add Sparse Compressed tensor support to torch.clone
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77512

Approved by: https://github.com/cpuhrsch
2022-05-17 16:29:41 +00:00
jjsjann123
98a20ebb0f updating tolerance override (#77402)
Seeing flake test failures locally and verified that's specific to some input random values.
Bumping up tolerance make tests happy.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77402
Approved by: https://github.com/mruberry
2022-05-17 15:57:20 +00:00
lezcano
369d9f4137 A few forward AD formulas
It includes all-time favourites like:
- `put`
- `nn.functional.embedding`
- `prelu`
- `nn.functional.bilinear`
- `nn.functional.rrelu`
- `nn.functional.logsigmoid`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77421

Approved by: https://github.com/soulitzer
2022-05-17 15:55:51 +00:00
Edward Z. Yang
4d3930fe8a Fix mypy lint failure
Signed-off-by: Edward Z. Yang <ezyangfb.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77652

Approved by: https://github.com/SherlockNoMad
2022-05-17 15:48:48 +00:00
Khushi Agrawal
387cccb1e9 [complex32, jiterator] angle (#76692)
Follows #74748 and #74537

cc @kshitij12345
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76692
Approved by: https://github.com/kshitij12345, https://github.com/anjali411
2022-05-17 15:44:47 +00:00
Kshiteej K
5a16f84911 [chalf] enable testing for multiple ops (#77404)
Ref: https://github.com/pytorch/pytorch/issues/74537

Enable testing for `narrow, isfinite, isinf, isreal, flatten, bfloat16, bool, char, double, float, chalf, empty_like, movedim`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77404
Approved by: https://github.com/anjali411
2022-05-17 15:43:27 +00:00
PyTorch MergeBot
0d1329c4ea Revert "Add Sparse Compressed tensor support to torch.clone"
This reverts commit 942f04172a.

Reverted https://github.com/pytorch/pytorch/pull/77512 on behalf of https://github.com/atalman
2022-05-17 14:26:52 +00:00
kshitij12345
47809fe6c0 [composite compliance] backward: index_select, trace, repeat_interleave (#77578)
Reference : https://github.com/pytorch/pytorch/issues/69991
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77578
Approved by: https://github.com/Lezcano, https://github.com/zou3519
2022-05-17 14:17:10 +00:00
Brian Hirsh
f9f4896a07 fix torch.jit.tracing for at::lift (#77588)
After adding the `at::lift` op, it started getting traced during `torch.jit.trace`. We don't want that to happen for BC reasons
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77588
Approved by: https://github.com/ezyang
2022-05-17 14:13:46 +00:00
Nikita Vedeneev
3ccf35e003 nn.functional.glu: forward over reserse AD support (#77309)
As per title. To knock out functions from https://github.com/pytorch/pytorch/issues/75432.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77309
Approved by: https://github.com/soulitzer
2022-05-17 13:29:14 +00:00
David Berard
d0dc7cb774 Reland "[JIT] during freezing, cast optional bias to half if weight is half"
Original PR: #77295

Original commit message:
On GPU, conv errors if not all its inputs have the same dtype.

In the case of autocasting during freezing, what we see is:
1) inputs to conv are casted to half
2) inputs to batchnorm are not casted, so many are still floats
3) we try to fold conv + batchnorm, by finding different weight and bias such that conv(input, new_weight, new_bias) is equivalent to the original conv -> batchnorm.

If conv previously had an optional bias, then during freezing we will temporarily create a zero-valued bias as a placeholder for conv_bias. We want to construct it to have the same dtype as the weight input to conv, to avoid errors on GPU.

Reland changes:
There's a memory leak from cuda caching allocator that is a side effect of this fix. The memory leak causes the test to fail, though for some reason it didn't fail on CI in the last PR. This skips the tests for now.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77617

Approved by: https://github.com/eellison
2022-05-17 12:25:26 +00:00
Vasiliy Kuznetsov
9cc92d5358 quant docs: best practices for quantization accuracy debugging
Summary:

This PR creates a best practices guideline for debugging quantization
accuracy. The content here comes from https://fburl.com/gdoc/nzlzxeaf,
with experimental and Meta-only parts left out.

For now, a lot of the debugging is manual, with the Numeric Suite the
only tool we have to help the user find root causes of quantization
inaccuracies. As we build additional tools for equalization detection,
outlier detection, etc, we will add them to this page

Test plan:

```
cd docs
make html
cd build/html
python -m server.http
// result renders well in browser
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77536

Approved by: https://github.com/hx89
2022-05-17 12:16:52 +00:00
Yukio Siraichi
9d44250760 Reduce structured kernels' set_output boilerplate with new overloads.
Partially fix #69813
This PR does mainly 3 things:

1. Introduces new methods for the `MetaBase` API:
    - `set_output_strided`: creates proxy tensors with exact strides, if strides don't match
    - `set_output_contiguous`: alias for `set_output_strided` with contiguous strides
    - `set_output_raw_strided`: does not create proxy tensors

2. Modifies codegen for handling proxy tensors:
    - Creates a new field for out-of-place kernels: `proxy_output_`
    - Implements `set_output_strided` by creating a proxy tensor if necessary
    - Passes the proxy tensor to them `IMPL` function
    - Copy the result back to the real output, in the end, whenever a proxy was created

3. Replace `set_output` by `set_output_raw_strided` for `TensorIterator*`
    - Needed, since it overrides `set_output`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/76096

Approved by: https://github.com/ezyang
2022-05-17 12:01:53 +00:00
pritam
c83f8ee46a Fix partial_tensor ops.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77580

Replace process_group with _process_group.

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

Approved by: https://github.com/wanchaol, https://github.com/fduwjj
2022-05-17 08:21:38 +00:00
Jordan Fix
18e36a6295 [graph_manipulation] Set fused dtypes for all constant params/buffers (#77401)
Summary: We were handling constant attrs in a few different ways before, leading to confusion and missed handing for fused dtypes. This diff consolidates some of that code and unbreaks current breakage.

Test Plan: CI. Recently broken tests now pass.

Differential Revision: D36335238

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77401
Approved by: https://github.com/jaybean-dev, https://github.com/jamesr66a
2022-05-17 07:42:29 +00:00
Pearu Peterson
942f04172a Add Sparse Compressed tensor support to torch.clone
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77512

Approved by: https://github.com/cpuhrsch
2022-05-17 07:32:46 +00:00
Horace He
0e351c7df9 Added setattr to functional_call. (#77137)
Fixes https://github.com/pytorch/pytorch/issues/77133

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77137
Approved by: https://github.com/emcastillo, https://github.com/albanD, https://github.com/jbschlosser
2022-05-17 05:40:46 +00:00
Michael Andreas Dagitses
e517fc8b28 eliminate Bazel's libtorch_cpp_generated_sources
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76179

This list is redundant with the shared build structure.

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

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D35818500/)!

Approved by: https://github.com/dreiss
2022-05-17 03:46:49 +00:00
Michael Andreas Dagitses
a013d83bf9 eliminate Bazel's libtorch_python_generated_sources
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76178

These contents are already identified in the shared build structure.

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

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D35817999/)!

Approved by: https://github.com/dreiss
2022-05-17 03:43:02 +00:00
Rohan Varma
f9f8127414 CheckpointWrapper state_dict fix (#77224)
- Uses state dict / load state dict hooks to ensure that modules wrapped with `CheckpointWrapper` can be loaded into non-checkpointed wrapped module.

This is because a training run can use activation checkpointing, then we can recover `state_dict`, and a future run may not want to wrap modules with activation checkpointing or decide to change activation checkpoint wrapping structure. To support this, we add hooks to remove / add the relevant prefix as needed.

Tests are added to ensure we can load into CheckpointWrapper module as well as local module from CheckpointWrapper-wrapped module. state_dict with FSDP is also verified.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77224
Approved by: https://github.com/zhaojuanmao
2022-05-17 03:39:31 +00:00
Nikita Shulga
4b4a6a0b19 Use TensorPipe libuv in Gloo (#77312)
Otherwise, its possible to build TensorPipe with one version of libuv
and gloo with another.

Also, delete strange `GLOO_INSTALL` logic, as none of the install artifacts are really packaged as part of PyTorch (and it were probably used by Caffe2 builds)

This helps solve problem for compiling PyTorch for M1, where `libuv` is not available in conda

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77312
Approved by: https://github.com/seemethere
2022-05-17 03:31:48 +00:00
Nikita Shulga
6aea0b1073 [CI] Make install_user.sh compatible with Focal (#77622)
By adding explicit `/etc/shadow` entry

Also, add test that it works, by running `sudo -v` as user `jenkins`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77622
Approved by: https://github.com/kit1980
2022-05-17 03:03:56 +00:00
Rodrigo Kumpera
668599a673 Rewrite ShardedTensor.gather to use dist.gather instead of gather_object (#77272)
gather_object is problematic when used with Tensors as they can unpickle on the wrong
device and lead to deadlocks or spurious failures.

This change introduces a RPC workaround for EFA when initing TensorPipe until
they properly address it.

Fixes #73935

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77272
Approved by: https://github.com/pritamdamania87
2022-05-17 02:14:40 +00:00
PyTorch MergeBot
5e3e5a5403 Revert "Python function to extract information on mobile::Module from flatbuffer (#77328)"
This reverts commit 69fa49f123.

Reverted https://github.com/pytorch/pytorch/pull/77328 on behalf of https://github.com/atalman
2022-05-17 01:35:05 +00:00
sijiac
efcbbb177e [Re-submit] Make tracer be able to trace different forward functions
Summary: The root module may have different forward functions. The current implementation assumes only the func forward can be traced. In this PR, we add an attribute func name to Tracer class to enable users trace different functions

Test Plan:
python3 test/test_fx.py TestFX.test_trace_multiple_funcs

Reviewers:

Subscribers:

Tasks:

Tags:

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77502

Approved by: https://github.com/jamesr66a
2022-05-17 01:05:33 +00:00
PyTorch MergeBot
246078e251 Revert "[JIT] during freezing, cast optional bias to half if weight is half"
This reverts commit 2547be5135.

Reverted https://github.com/pytorch/pytorch/pull/77295 on behalf of https://github.com/malfet
2022-05-17 00:34:51 +00:00
PyTorch MergeBot
f1c8e8fa4e Revert "Add Sparse Compressed tensor support to torch.clone"
This reverts commit 20ba6e6935.

Reverted https://github.com/pytorch/pytorch/pull/77512 on behalf of https://github.com/malfet
2022-05-17 00:31:49 +00:00
Nikita Shulga
4596ecb4d2 [BE] Move numba pinned version to requirements-ci.txt
Specify different pinned versions for older vs newer python runtime

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77476

Approved by: https://github.com/mehtanirav
2022-05-17 00:30:32 +00:00
Linbin Yu
1f8049566f Re-land BUCK build for pytorch mobile (#77612)
see https://github.com/pytorch/pytorch/pull/76480
fixed most lint errors
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77612
Approved by: https://github.com/kit1980
2022-05-17 00:30:13 +00:00
Xiang Gao
0975174652 Fix doc about type promotion of lshift and rshift (#77613)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77613
Approved by: https://github.com/ngimel
2022-05-17 00:28:48 +00:00
Christian Puhrsch
89e32f52c7 Change test_sparse_csr test signatures (#77595)
Some consuming tools aren't equipped to split on the "(" and ")" induced by passing tuples to parametrize.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77595
Approved by: https://github.com/malfet
2022-05-17 00:24:08 +00:00
Tugsbayasgalan Manlaibaatar
31d9f7c303 Move other div variants to upgraders map
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73586

Approved by: https://github.com/gmagogsfm
2022-05-16 22:32:15 +00:00
Pearu Peterson
20ba6e6935 Add Sparse Compressed tensor support to torch.clone
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77512

Approved by: https://github.com/cpuhrsch
2022-05-16 22:21:49 +00:00
David Berard
2547be5135 [JIT] during freezing, cast optional bias to half if weight is half
On GPU, conv errors if not all its inputs have the same dtype.

In the case of autocasting during freezing, what we see is:
1) inputs to conv are casted to half
2) inputs to batchnorm are not casted, so many are still floats
3) we try to fold conv + batchnorm, by finding different weight and bias such that conv(input, new_weight, new_bias) is equivalent to the original conv -> batchnorm.

If conv previously had an optional bias, then during freezing we will temporarily create a zero-valued bias as a placeholder for conv_bias. We want to construct it to have the same dtype as the weight input to conv, to avoid errors on GPU.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77295

Approved by: https://github.com/eellison
2022-05-16 22:18:47 +00:00
Pearu Peterson
9a608af828 Support comparing Sparse Compressed tensors
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77525

Approved by: https://github.com/pmeier, https://github.com/cpuhrsch
2022-05-16 22:13:53 +00:00
Jane Xu
f9aaf9d388 [GH1] Allow conclusions to include workflows and checks (#77597)
Remove the continue to allow both workflows and check runs be included in the list of checks. This allows checks to be added as required checks in merge_rules
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77597
Approved by: https://github.com/seemethere
2022-05-16 21:45:12 +00:00
Wanchao Liang
25fa964d96 [shard] add clone/detach and set requires_grad for ShardedTensor
This PR adding clone/detach and set requires_grad to ShardedTensor

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77367

Approved by: https://github.com/pritamdamania87
2022-05-16 21:42:27 +00:00
Bin Bao
25c6ebd12c Revert "Revert "[LT] Codegen ReuseNode for supported ops""
Summary: Fixed a XLC build failure by generating an always-return-false
default CanBeReused method.

This reverts commit 3cade9d454.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77513

Approved by: https://github.com/alanwaketan
2022-05-16 20:14:42 +00:00
Natalia Gimelshein
375e21b2c6 check that flip doesn't accept repeating dimensions (#77500)
Per title.
Before this PR `flip` throws errors on invalid inputs from ATen implementation itself, and not from error checks happening in prims/refs.
We should make sure that prims/refs do all the necessary error checking (@mruberry is going to test that by moving reference error inputs testing to call meta implementations instead of real ones).
In general, most error checking should live in refs, prims meta functions should propagate the necessary properties, but they should assume that they are getting valid inputs. The checks on the inputs should happen in refs, where they can be traced to the necessary guards, or lead to RuntimeErrors during tracing.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77500
Approved by: https://github.com/mruberry
2022-05-16 19:33:14 +00:00
Mikayla Gawarecki
fe1232a494 Use FastAtomicAdd for index_add/_index_reduce
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76996

Approved by: https://github.com/cpuhrsch, https://github.com/ngimel
2022-05-16 19:10:19 +00:00
zengk95
906fc77745 [mergebot cli] add new revert regex (#77459)
Since we added a new CLI, we have to update the regex validator for reverting. The same validation is not there for merging.

The example command we want to validate:
`@pytorchbot merge -c="ghfirst" -m="this is breaking things internally"`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77459
Approved by: https://github.com/malfet, https://github.com/janeyx99
2022-05-16 19:02:01 +00:00
Pearu Peterson
d76efed578 Add Sparse CSC support to torch.empty
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77508

Approved by: https://github.com/cpuhrsch
2022-05-16 18:53:56 +00:00
Pearu Peterson
77f1ca0065 Replace SparseCsrTensorImpl crow/col_indices with compressed/plain_indices
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77504

Approved by: https://github.com/cpuhrsch
2022-05-16 18:51:32 +00:00
jjsjann123
1b1dec4529 stirde_properties fix (#77460)
Fixes part of #6015

profiled permutation order is wrong and nvfuser generates output in wrong memory format. Though this problem doesn't seem to cause any issue with the test (except a graceful fallback path taken by CudaFusionGuard).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77460
Approved by: https://github.com/davidberard98, https://github.com/ngimel
2022-05-16 18:49:52 +00:00
Mikayla Gawarecki
7ba4e124e6 Bugfix gradient formula for index_reduce('prod') + separate out sample_inputs for index_reduce
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77382

Approved by: https://github.com/cpuhrsch
2022-05-16 18:43:57 +00:00