Andrew M. James
ff6770a9a1
enable backward for log1p (sparse layouts) ( #88155 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88155
Approved by: https://github.com/cpuhrsch
2022-11-04 20:59:26 +00:00
Andrew M. James
6938dd0b2c
Support sparse inputs to deg2rad ( #88156 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88156
Approved by: https://github.com/cpuhrsch
2022-11-04 20:59:26 +00:00
PyTorch MergeBot
71fb763e54
Revert "fix as_strided_scatter_backward ( #87646 )"
...
This reverts commit f9d7985851 .
Reverted https://github.com/pytorch/pytorch/pull/87646 on behalf of https://github.com/huydhn due to Sorry for reverting your PR but I think this one or one of the PR in the stack break bionic-cuda11.7 on trunk 70782981f0
2022-11-02 16:54:36 +00:00
Brian Hirsh
f9d7985851
fix as_strided_scatter_backward ( #87646 )
...
as_strided_scatter's derivative formula was broken - instead of making a "mask" of 1's and 0's, it would effectively make a mask of 1's and uninitialized memory.
Fixes https://github.com/pytorch/pytorch/issues/88105
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87646
Approved by: https://github.com/albanD
2022-11-02 14:36:49 +00:00
albanD
8a9aca7b8d
Reland 2 Many symintifications ( #87604 ) ( #87980 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87980
Approved by: https://github.com/ezyang
2022-10-28 13:40:11 +00:00
PyTorch MergeBot
8b4d95759c
Revert "Many symintifications ( #87604 )"
...
This reverts commit 777e6a2c51 .
Reverted https://github.com/pytorch/pytorch/pull/87604 on behalf of https://github.com/weiwangmeta due to breaking internal builds
2022-10-28 03:00:11 +00:00
albanD
777e6a2c51
Many symintifications ( #87604 )
...
Adds
expand_inplace
conv conv_double_backward
convolution
adaptive_avg_pool2d_symint
_embedding_bag_backward_symint
cudnn_grid_sampler
cuda 32 bit indexing
nll_loss / nll_loss_2d
tensor split
pooling same mode
cudnn_is_acceptable
storage nbytes
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87604
Approved by: https://github.com/ezyang
2022-10-26 17:33:53 +00:00
albanD
12b2f70a89
Symintify pad ops ( #87046 )
...
Following comments below, we need to add support for `std::negate`/`std::min`/`std::max`/`operator-` for SymInt
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87046
Approved by: https://github.com/ezyang
2022-10-19 21:43:08 +00:00
Nikita Vedeneev
f2ec9fbd03
torch.ormqr: backward support (#86800 )
...
Seems good to have, especially when neither `a` nor `tau` requires grads and/or they are pretty small in number.
Fixes https://github.com/pytorch/pytorch/issues/86267
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86800
Approved by: https://github.com/lezcano
2022-10-18 09:07:35 +00:00
albanD
3a4c0900c7
Reland 3 of Merge more symbolic meta kernels and symint changes from branch ( #86795 )
...
Take 3
Contains:
- symintification of split*
- floor support on SymFloat
- pad_backward, gather, scatter meta
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86795
Approved by: https://github.com/z-a-f
2022-10-17 02:09:40 +00:00
Brian Hirsh
34c86adec4
symintify all of derivatives.yaml ( #86610 )
...
Big-bang PR to symintify **all** .sizes() calls in derivatives.yaml, which will be needed for symbolic tracing.
* with the exception of `split()`, which is tougher to land because it requires internal changes.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86610
Approved by: https://github.com/albanD
2022-10-14 20:15:48 +00:00
albanD
66cab5245f
Reland 2 min/max support for SymInt/Floats, finish as_strided/scatter/squeeze() backward symint support ( #86797 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86797
Approved by: https://github.com/bdhirsh
2022-10-13 00:31:19 +00:00
PyTorch MergeBot
2aa981ab74
Revert "Reland 2 of Merge more symbolic meta kernels and symint changes from branch ( #86334 ) ( #86488 )"
...
This reverts commit 978b46d7c9 .
Reverted https://github.com/pytorch/pytorch/pull/86488 on behalf of https://github.com/osalpekar due to Broke executorch builds internally with the following message: RuntimeError: Missing out variant for functional op: aten::split.Tensor(Tensor(a -> *) self, SymInt split_size, int dim=0) -> Tensor(a)[] . Make sure you have loaded your custom_ops_generated_lib
2022-10-11 23:39:50 +00:00
PyTorch MergeBot
811b8e012b
Revert "min/max support for SymInt/Floats, finish as_strided/scatter/squeeze() backward symint support ( #86643 )"
...
This reverts commit 86f914e996 .
Reverted https://github.com/pytorch/pytorch/pull/86643 on behalf of https://github.com/osalpekar due to Need to revert this to cleanly revert https://github.com/pytorch/pytorch/pull/86488 . This should be safe to re-land later
2022-10-11 23:12:40 +00:00
albanD
86f914e996
min/max support for SymInt/Floats, finish as_strided/scatter/squeeze() backward symint support ( #86643 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86643
Approved by: https://github.com/anjali411
2022-10-11 17:37:30 +00:00
albanD
978b46d7c9
Reland 2 of Merge more symbolic meta kernels and symint changes from branch ( #86334 ) ( #86488 )
...
symintify split_with_sizes, dropout, fused_fake_obs_quant. meta for padding_2d ops
add meta_bernoulli_
meta kernel for at::gather
get pytorch_struct to pass: meta for scatter_add, fix backward
symintify split ops
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86488
Approved by: https://github.com/ezyang
2022-10-10 15:54:28 +00:00
anjali411
c89d286af6
symintify unbind_backward and tensor_split ( #86357 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86357
Approved by: https://github.com/albanD
2022-10-09 16:25:55 +00:00
Edward Z. Yang
33f0e98a49
Re-land*4 "SymIntify cat and narrow" ( #86468 )
...
This re-lands https://github.com/pytorch/pytorch/pull/86289 but with more wrappers.
Contains implicit inclusion of <ATen/native/NonSymbolicBC.h> in internal usage.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86468
Approved by: https://github.com/albanD
2022-10-08 07:17:37 +00:00
PyTorch MergeBot
65b408074f
Revert "Relandx3 "SymIntify cat and narrow" ( #86289 )"
...
This reverts commit a00f8489df .
Reverted https://github.com/pytorch/pytorch/pull/86289 on behalf of https://github.com/malfet due to @seemether unlanded the rest of the stack and it will fail intern import anyway
2022-10-07 16:29:27 +00:00
PyTorch MergeBot
75df4b5e3d
Revert "Merge more symbolic meta kernels and symint changes from branch ( #86334 )"
...
This reverts commit 08e3999fa4 .
Reverted https://github.com/pytorch/pytorch/pull/86334 on behalf of https://github.com/seemethere due to Trying to revert https://github.com/pytorch/pytorch/pull/86207 , this PR causes merge conflicts with the initial revert so will have to revert this as well
2022-10-07 16:03:30 +00:00
Edward Z. Yang
a00f8489df
Relandx3 "SymIntify cat and narrow" ( #86289 )
...
This reverts commit fc94a2115b .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86289
Approved by: https://github.com/wconstab
2022-10-07 14:04:10 +00:00
PyTorch MergeBot
2110c89443
Revert "Revert "Revert "SymIntify cat and narrow ( #86191 )"" ( #86289 )"
...
This reverts commit e778fbf519 .
Reverted https://github.com/pytorch/pytorch/pull/86289 on behalf of https://github.com/seemethere due to Fails internal tests see: https://www.internalfb.com/intern/sandcastle/job/27021598552487548/
2022-10-07 05:20:36 +00:00
Brian Hirsh
08e3999fa4
Merge more symbolic meta kernels and symint changes from branch ( #86334 )
...
symintify split_with_sizes, dropout, fused_fake_obs_quant. meta for padding_2d ops
add meta_bernoulli_
meta kernel for at::gather
get pytorch_struct to pass: meta for scatter_add, fix backward
symintify split ops
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86334
Approved by: https://github.com/ezyang
2022-10-06 23:29:04 +00:00
Pearu Peterson
8f2c2167d4
Support autograd on sparse_mm in full. ( #86301 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86301
Approved by: https://github.com/cpuhrsch
2022-10-06 18:39:31 +00:00
Pearu Peterson
f104490d63
Support autograd on Linear with sparse compressed weight. ( #86137 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86137
Approved by: https://github.com/cpuhrsch
2022-10-06 18:39:25 +00:00
Edward Z. Yang
e778fbf519
Revert "Revert "SymIntify cat and narrow ( #86191 )"" ( #86289 )
...
This reverts commit fc94a2115b .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86289
Approved by: https://github.com/wconstab
2022-10-05 20:51:28 +00:00
PyTorch MergeBot
fc94a2115b
Revert "SymIntify cat and narrow ( #86191 )"
...
This reverts commit 63d8d4f6ec .
Reverted https://github.com/pytorch/pytorch/pull/86191 on behalf of https://github.com/seemethere due to Fails internal tests, see [D40106464](https://www.internalfb.com/diff/D40106464 )
2022-10-05 17:19:55 +00:00
Will Constable
63d8d4f6ec
SymIntify cat and narrow ( #86191 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86191
Approved by: https://github.com/ezyang
2022-10-05 14:46:55 +00:00
Edward Z. Yang
79dd621f76
Symbolic shapes mega merge PR (Oct 3) ( #86160 )
...
- TensorGeometry supports symint
- check_size supports symint
- functorch batch rule improved symint
- Some operator support for symint in LTC
- More supported operations on SymInt and SymFloat
- More symint support in backwards formulas
This merge includes code contributions from bdhirsh and anjali411.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86160
Approved by: https://github.com/Chillee
2022-10-04 04:12:09 +00:00
Edward Z. Yang
2aa9e0750a
Symintified all functions, not including factory functions ( #86078 )
...
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86078
Approved by: https://github.com/Chillee , https://github.com/albanD
2022-10-03 20:12:32 +00:00
Edward Z. Yang
3638089755
Ported reshape to symints and added a shim for BC ( #85998 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85998
Approved by: https://github.com/ezyang
2022-10-02 17:46:00 +00:00
Horace He
a4bd89b267
Revert "Revert "Symintified mmm/addmm derivative formulas ( #85794 )"" ( #85820 )
...
This reverts commit 823dc33b00 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85820
Approved by: https://github.com/huydhn
2022-09-28 17:34:11 +00:00
PyTorch MergeBot
a0b1693996
Revert "Update amax/amin/norm/count_nonzero signatures with int[*]? dim ( #83300 )"
...
This reverts commit 1c0f0b33a0 .
Reverted https://github.com/pytorch/pytorch/pull/83300 on behalf of https://github.com/jeffdaily due to The commit breaks nvfuser tests
2022-09-28 17:04:53 +00:00
PyTorch MergeBot
823dc33b00
Revert "Symintified mmm/addmm derivative formulas ( #85794 )"
...
This reverts commit 230edd2515 .
Reverted https://github.com/pytorch/pytorch/pull/85794 on behalf of https://github.com/janeyx99 due to Sorry, reverting as this breaks an aot_autograd mac test on functorch 230edd2515
2022-09-28 16:02:05 +00:00
Horace He
230edd2515
Symintified mmm/addmm derivative formulas ( #85794 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85794
Approved by: https://github.com/ezyang
2022-09-28 14:07:57 +00:00
Edward Z. Yang
793488cda2
Revert "Revert "Symintifying slice ops ( #85196 )"" ( #85746 )
...
This reverts commit 3a171dfb0c .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85746
Approved by: https://github.com/albanD
2022-09-28 04:37:35 +00:00
Kurt Mohler
1c0f0b33a0
Update amax/amin/norm/count_nonzero signatures with int[*]? dim ( #83300 )
...
Changes `dim` arg to use `int[*]?` type for the following functions in `native_funcitons.yaml`:
* `amax`
* `amin`
* `norm`
* `frobenius_norm`
* `native_norm`
* `count_nonzero`
Part of #29137
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83300
Approved by: https://github.com/ngimel , https://github.com/albanD , https://github.com/kulinseth
2022-09-28 01:56:37 +00:00
PyTorch MergeBot
572dd862c4
Revert "Update amax/amin/norm/count_nonzero signatures with int[*]? dim ( #83300 )"
...
This reverts commit 8c7c7ed322 .
Reverted https://github.com/pytorch/pytorch/pull/83300 on behalf of https://github.com/huydhn due to The commit pin breaks XLA test somehow
2022-09-28 01:36:43 +00:00
Kurt Mohler
8c7c7ed322
Update amax/amin/norm/count_nonzero signatures with int[*]? dim ( #83300 )
...
Changes `dim` arg to use `int[*]?` type for the following functions in `native_funcitons.yaml`:
* `amax`
* `amin`
* `norm`
* `frobenius_norm`
* `native_norm`
* `count_nonzero`
Part of #29137
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83300
Approved by: https://github.com/ngimel , https://github.com/albanD , https://github.com/kulinseth
2022-09-27 23:50:04 +00:00
PyTorch MergeBot
3a171dfb0c
Revert "Symintifying slice ops ( #85196 )"
...
This reverts commit 4c01c51266 .
Reverted https://github.com/pytorch/pytorch/pull/85196 on behalf of https://github.com/atalman due to Break internal build Exutorch
2022-09-27 18:01:27 +00:00
Brian Hirsh
4a2d2e5e40
Change API type Tensor[] for structured kernels. ( #73350 )
...
Partially fixes : #66328
This PR:
- adds support for `ITensorList` to the dispatcher for:
- computing the dispatch key
- boxing and unboxing `ITensorList`
- modified the codegen for structured kernels:
- codegen APIs use `ITensorList` instead of `ArrayRef<Tensor>`
**Changes summary:**
- Signature changes due to the different APIs:
- dispatcher API (e.g. `BatchingRegistrations.cpp`)
- C++ API (e.g. `TensorShape.cpp`)
- Miscelaneous functions used by codegen'd functions (e.g. `FunctionalTensorWrapper.*`)
- Dispatcher changes for handling `ITensorList` correctly (e.g. `DispatchKeyExtractor.h`)
- Signature changes of `at::cat` due to the need of `const` inside `TensorBody.h`
- Forward declarations of `ITensorList` (e.g. `MethodOperators.h`)
- Codegen changes, special casing structured kernels (e.g. `gen.py`)
**Short description of structured kernels special casing:**
I introduced, mainly, 5 types of changes to the codegen for generating code depending on
whether the kernel is structured or not:
1. Added a `structured_type_override` flag to the `argument_type` function definition of
the affected APIs (mainly the dispatcher and C++ APIs).
- `api/cpp.py`, `api/dispatcher.py`, `api/native.py`
2. Added a `structured_type_override` member to the signature
classes (e.g. `CppSignature`), since `FunctionSchema` doesn't really know whether the
function is structured or not
- `api/types.py`
3. Added a `part_of_structured_group` to `NativeFunction` class, which is just a
convenient function to forward to `structured_type_override` wherever needed
- `model.py`
4. Appropriately changed the rest of the codegen, whenever it used either the signature
classes or the `arguments` function directly
5. Added a check for `const ITensorList&` type wherever there was a check for `TensorList`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73350
Approved by: https://github.com/bdhirsh
2022-09-26 21:46:38 +00:00
Edward Z. Yang
4c01c51266
Symintifying slice ops ( #85196 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85196
Approved by: https://github.com/ezyang
2022-09-23 22:01:32 +00:00
Mikayla Gawarecki
77f1f98479
Re-introduce torch.Tensor.to_padded_tensor ( #85293 )
...
Differential Revision: [D39629004](https://our.internmc.facebook.com/intern/diff/D39629004 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85293
Approved by: https://github.com/cpuhrsch
2022-09-21 18:45:56 +00:00
Edward Z. Yang
3eb27229dd
as_strided symbolic support ( #85264 )
...
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Differential Revision: [D39662820](https://our.internmc.facebook.com/intern/diff/D39662820 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85264
Approved by: https://github.com/wconstab
2022-09-21 13:34:55 +00:00
Benoit Steiner
86d8c61c7c
Revert D39583438: Multisect successfully blamed D39583438 for test or build failures ( #85277 )
...
Summary:
This diff is reverting D39583438
D39583438 has been identified to be causing the following test or build failures:
Tests affected:
- https://www.internalfb.com/intern/test/281475048999851/
Here's the Multisect link:
https://www.internalfb.com/intern/testinfra/multisect/1260522
Here are the tasks that are relevant to this breakage:
T124797105: 18 tests started failing for employee benoitsteiner in the last 2 weeks
We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.
Test Plan: NA
Reviewed By: benoitsteiner
Differential Revision: D39599694
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85277
Approved by: https://github.com/dagitses
2022-09-20 15:38:58 +00:00
kshitij12345
a4dca9822d
[composite compliance] prod ( #81969 )
...
Ref: #69991
Also fixes #82644 (fix similar to #81617 )
For CompositeCompliance, we can't use `item` to choose a special fast-path when Tensor is a Subclass. Instead we always dispatch to the slower but safer implementation.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81969
Approved by: https://github.com/zou3519
2022-09-20 08:03:36 +00:00
Thomas Viehmann
e41d758e26
Handle implicit real->complex casting for backward of stack ( #84993 )
...
Fixes : #75852
P.S.: Yay for the PyTorch foundation.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/84993
Approved by: https://github.com/soulitzer
2022-09-19 21:20:34 +00:00
lezcano
d710c95cc0
Implement forward AD for scatter_reduce ( #85000 )
...
I left the case `reduction="prod"` for future work as it's a bit of a pain.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85000
Approved by: https://github.com/soulitzer
2022-09-16 17:45:07 +00:00
Elias Ellison
54c9c4e73d
Flip fake tensors on in aot autograd ( #84968 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/84968
Approved by: https://github.com/Chillee
2022-09-16 15:27:48 +00:00
Pearu Peterson
a225f3cfce
torch.zero_ on a sparse compressed tensor resets nnz to 0 ( #85030 )
...
Fixes #84997 and #82683
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85030
Approved by: https://github.com/cpuhrsch
2022-09-15 18:42:38 +00:00