Commit Graph

6 Commits

Author SHA1 Message Date
Serhat Yilmaz
20eac093a7 [torch][segment_reduce] Add support for initial value (#56923)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56923

Next Steps in order:
- Add backward support for CUDA
- Add support for more aggregation types
- Benchmarking (for cuda mainly)/more testing/documentation
- Support for multi dimension

Test Plan: Updated unit test to include 0 length segment as well.

Reviewed By: ngimel

Differential Revision: D27992228

fbshipit-source-id: 28851811f8a784a63162721c511d69e617a93727
2021-04-30 18:01:31 -07:00
Serhat Yilmaz
e27740b38e [torch] Add backward support for segment reduce (CPU only)
Summary:
This is to setup boiler plate code for backward and CPU implementation.

Next Steps in order:
- Add backward support for CUDA
- Add support for more aggregation types
- Benchmarking (for cuda mainly)/more testing/documentation
- Support for multi dimension

Test Plan:
Updated unit test to also check correctness of backward.

Wait for CI signal

Reviewed By: ngimel

Differential Revision: D27970340

fbshipit-source-id: 3e608c7fe3628b0a761dd8affc6aad8f65a6ef7f
2021-04-29 15:41:37 -07:00
Serhat Yilmaz
6c37788cb1 [torch] Add cuda support for segment reduction 'max' (#56704)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56704

This is re submit of PR: https://github.com/pytorch/pytorch/pull/54175

Main changes compared to original PR:
- Switch to importing "<ATen/cuda/cub.cuh>"
- Use CUB_WRAPPER to reduce boiler plate code.

Test Plan:
Will check CI status to make sure a

Added unit test

Reviewed By: ngimel

Differential Revision: D27941257

fbshipit-source-id: 24a0e0c7f6c46126d2606fe42ed03dca15684415
2021-04-27 11:29:03 -07:00
Kimish Patel
364639041f Revert D27121170: [torch] Add cuda support for segment reduction 'max'
Test Plan: revert-hammer

Differential Revision:
D27121170 (eb5e1fc713)

Original commit changeset: 1c2565f42e29

fbshipit-source-id: 3dd394edcf5ef53c27098b4d0a1dd6fbbabdd506
2021-04-08 15:30:58 -07:00
Serhat Yilmaz
eb5e1fc713 [torch] Add cuda support for segment reduction 'max' (#54175)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54175

Building on top of previous PR. This PR adds cuda support for 1D max reduction.

Next steps:
- Add support for other major reduction types (e.g. min, sum) for 1D tensor
- Documentation for the op
- Perf optimizations and benchmark util
- Backward support  (not high priority)
- Support for multi dimensional tensors (on data and lengths) (not high priority)
- Support for 'indices' (not high priority)

Test Plan: Added unit test

Reviewed By: ngimel

Differential Revision: D27121170

fbshipit-source-id: 1c2565f42e2903e6fc089d56983ce8857efbfa3c
2021-04-08 13:25:55 -07:00
Serhat Yilmaz
7e3cf1ee24 [pytorch] Add native support for segment reduce step1: API definition (#53727)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53727

This is first diff to add native support for segment reduction in PyTorch. It provides similar functionality like torch.scatter or "numpy.ufunc.reduceat".

This diff mainly focuses on API layer to make sure future improvements will not cause backward compatibility issues. Once API is settled, here are next steps I am planning:
- Add support for other major reduction types (e.g. min, sum) for 1D tensor
- Add Cuda support
- Backward support
- Documentation for the op
- Perf optimizations and benchmark util
- Support for multi dimensional tensors (on data and lengths) (not high priority)
- Support for 'indices' (not high priority)

Test Plan: Added unit test

Reviewed By: ngimel

Differential Revision: D26952075

fbshipit-source-id: 8040ec96def3013e7240cf675d499ee424437560
2021-03-23 16:00:30 -07:00