Commit Graph

3 Commits

Author SHA1 Message Date
Gao, Xiang
c5624e831d Add overloads of std:: math functions for c10::complex [resubmit] (#37468)
Summary:
This reverts commit d167a7f654.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37468

Differential Revision: D21305110

Pulled By: anjali411

fbshipit-source-id: d1bdc9d9feac00331fc2b2b905d49f80bef680f9
2020-04-30 10:20:45 -07:00
Lu Fang
d167a7f654 Revert D21256854: [pytorch][PR] Add overloads of std:: math functions for c10::complex
Test Plan: revert-hammer

Differential Revision:
D21256854

Original commit changeset: 2112ba6b7992

fbshipit-source-id: b81c377f9cd33a493a63d1e666cbe6765516fca8
2020-04-27 13:23:34 -07:00
Gao, Xiang
6d409481b3 Add overloads of std:: math functions for c10::complex (#35725)
Summary:
Issue: https://github.com/pytorch/pytorch/issues/35284

~This depends on and contains https://github.com/pytorch/pytorch/pull/35524. Please review after the dependency gets merged and I will rebase to get a clean diff.~

The implementation of most functions follow the pattern

```C++
template<typename T>
C10_HOST_DEVICE c10::complex<T> some_function(c10::complex<T> x) {
#if defined(__CUDACC__) || defined(__HIPCC__)
  return static_cast<c10::complex<T>>(thrust::some_function(static_cast<thrust::complex<T>>(x)));
#else
  return static_cast<c10::complex<T>>(std::some_function(static_cast<std::complex<T>>(x)));
#endif
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35725

Differential Revision: D21256854

Pulled By: ezyang

fbshipit-source-id: 2112ba6b79923450feafd7ebdc7184a3eaecadb6
2020-04-27 10:32:16 -07:00