Commit Graph

20 Commits

Author SHA1 Message Date
f7ee061638 Wconstab/reland pysymint (#79795)
rebased https://github.com/pytorch/pytorch/pull/79617/ to see if issues are reproducible.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79795
Approved by: https://github.com/malfet
2022-06-20 22:55:06 +00:00
1b25aa6786 Support dropout(nested tensor) (#79318)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79318
Approved by: https://github.com/jbschlosser
2022-06-17 18:41:54 +00:00
8a7a5def1d Revert "Support dropout(nested tensor) (#79318)"
This reverts commit 1211ab679c81c4935c8142b34e9bd99e64d1f7d5.

Reverted https://github.com/pytorch/pytorch/pull/79318 on behalf of https://github.com/janeyx99 due to Broke dropout tests on trunk, also errors on PR
2022-06-17 04:56:29 +00:00
1211ab679c Support dropout(nested tensor) (#79318)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79318
Approved by: https://github.com/jbschlosser
2022-06-17 00:46:07 +00:00
f9656817df Add nested tensor support to autograd (#79446)
The issue that is tracking this work is: #79447

This is one in a series of PRs to add autograd support for nested tensors.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79446
Approved by: https://github.com/soulitzer
2022-06-16 21:09:17 +00:00
44436947bc Revert "Reland PySymInt (#79617)"
This reverts commit 8ef6356f267c75276ea23b51163274cd5fffc0ce.

Reverted https://github.com/pytorch/pytorch/pull/79617 on behalf of https://github.com/zengk95 due to this is breaking periodic jobs (and maybe pull) on trunk
2022-06-16 19:40:27 +00:00
8ef6356f26 Reland PySymInt (#79617)
Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79617
Approved by: https://github.com/Chillee
2022-06-16 04:18:06 +00:00
b8db0a0475 Revert "Python Bindings for SymInts (#78135)"
This reverts commit d332724071704939e1c50704f6bc62bb6c990383.

Reverted https://github.com/pytorch/pytorch/pull/78135 on behalf of https://github.com/ezyang due to broke torchvision tests
2022-06-15 13:52:14 +00:00
d332724071 Python Bindings for SymInts (#78135)
This PR adds support for `SymInt`s in python. Namely,
* `THPVariable_size` now returns `sym_sizes()`
* python arg parser is modified to parse PyObjects into ints and `SymbolicIntNode`s
* pybind11 bindings for `SymbolicIntNode` are added, so size expressions can be traced
* a large number of tests added to demonstrate how to implement python symints.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78135
Approved by: https://github.com/ezyang
2022-06-14 02:17:59 +00:00
6ad51c9422 Support indexing of the underlying tensors for nested tensors (#78934)
Fixes #76843

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78934
Approved by: https://github.com/cpuhrsch, https://github.com/jbschlosser
2022-06-08 21:05:04 +00:00
c81c0b6d42 Support clone for NestedTensor (#78826)
Potentially fixes #78754. Adding coverage for clone to NestedTensor surely won't hurt.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78826
Approved by: https://github.com/jbschlosser
2022-06-06 19:30:58 +00:00
76abbbe317 Adding output_size to to_padded_tensor (#76640)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76640

- Adding output_size argument to to_padded_tensor
- Modified add_padding_kernelLauncher and kernels to iterate over padded tensor batch size instead of nested tensor batch size
- No fast path for CPU version

Test Plan:
buck test mode/dev-nosan  //caffe2/test:nested

Performance test using N1763981:

{F728168808}

Reviewed By: cpuhrsch

Differential Revision: D36056902

fbshipit-source-id: d6df2939d6649128a7f43a2ef32d227870a8e583
(cherry picked from commit 09465f36f09d4d74c9b3303981d8cce0c7c1092a)
2022-05-03 18:22:51 +00:00
4d6b145bb2 Nested Tensor Elementwise (#76470)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76470

Adding elementwise add and mul for nested tensor

Test Plan:
```
buck test mode/dev-nosan //caffe2/test:nested
```

Perf testing with N1763981:

{F727236009}

Reviewed By: cpuhrsch

Differential Revision: D35773182

fbshipit-source-id: f1c0ac40716b616884de3db80cdc7baf141cde7f
(cherry picked from commit 3b3c8fd7b2922556dc1a6afc0cb29cf7da7d0fc1)
2022-05-03 18:22:51 +00:00
fd3cfb683a Fix string repr for nested tensors & run nested tensor tests
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76541

Approved by: https://github.com/ishaan-mehta, https://github.com/cpuhrsch
2022-04-28 20:51:30 +00:00
ea1901693e Port to_padded_tensor CUDA kernel from pytorch/nestedtensor
This PR adds a custom CUDA kernel to pad NestedTensors between dimension 2 and 4.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76157
Approved by: https://github.com/ngimel
2022-04-27 20:41:40 +00:00
0a5e788ab2 [PyTorch] Add NestedTensorCPU and NestedTensorCUDA dispatch keys (#75808)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75808

Just as it is often difficult to write a single kernel that can handle both CPU and CUDA, so can it be difficult to do the same for NestedTensor.
ghstack-source-id: 154171542

(Note: this ignores all push blocking failures!)

Test Plan: CI?

Reviewed By: bdhirsh

Differential Revision: D35603836

fbshipit-source-id: fb0ebb19d34531ed96ce176aca325f8e2b5f90e6
(cherry picked from commit 0bcd753f93c04256c1b745f84a74ecccf0dceef5)
2022-04-19 18:12:12 +00:00
97c993ca7a [PyTorch] Add NestedTensor support functions for transformers
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75491

Here are the NestedTensor kernels we'll need for the improved transformer implementation.

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

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

Approved by: https://github.com/cpuhrsch
2022-04-14 16:30:23 +00:00
70cab5ebb1 [PyTorch] NestedTensor kernels for {r,g}elu{,_}
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75370

These are simple element-wise ops it's convenient to be able to use with NestedTensor.

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

Approved by: https://github.com/ngimel
2022-04-08 17:54:09 +00:00
90be8fa279 [PyTorch] Make TensorImpl::sizes() customizable and disable it for NestedTensorImpl (#73817)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73817

NestedTensorImpl doesn't have sizes(). Silently getting wrong results back from it is not conducive to efficient software development. Make it throw while allowing sizes() to be inlined in the common case anyway, just like is_contiguous(). Thanks ezyang for the reminder that we could do this.
ghstack-source-id: 151302903

Test Plan: Updated test_nestedtensor.py

Reviewed By: ezyang

Differential Revision: D34660829

fbshipit-source-id: 1289f21127d6a8359893f9174f3c430a290f2c7f
(cherry picked from commit 7098b9fcfbd25a03bac19e1148426ff073810edd)
2022-03-15 19:24:57 +00:00
484c0de670 Minimal NestedTensor (#72881)
Summary:
This PR adds a minimal version of a NestedTensor. It introduces the general harness future development can be built around.

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

Reviewed By: albanD

Differential Revision: D34259177

Pulled By: cpuhrsch

fbshipit-source-id: 0245c36f603424e20f3b09651043c207f526d760
(cherry picked from commit 10764e8d427f29b364567e4cbc86ed73c3933158)
2022-03-02 16:31:51 +00:00