mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56830 Opt into formatting on GitHub and format everything. This is a trial run before turning on formatting for more and eventually all of the codebase. Test Plan: CI Reviewed By: zertosh Differential Revision: D27979080 fbshipit-source-id: a80f0c48691c08ae8ca0af06377b87e6a2351151
42 lines
958 B
C++
42 lines
958 B
C++
#if !defined(C10_INTERNAL_INCLUDE_COMPLEX_REMAINING_H)
|
|
#error \
|
|
"c10/util/complex_utils.h is not meant to be individually included. Include c10/util/complex.h instead."
|
|
#endif
|
|
|
|
#include <limits>
|
|
|
|
namespace c10 {
|
|
|
|
template <typename T>
|
|
struct is_complex : public std::false_type {};
|
|
|
|
template <typename T>
|
|
struct is_complex<std::complex<T>> : public std::true_type {};
|
|
|
|
template <typename T>
|
|
struct is_complex<c10::complex<T>> : public std::true_type {};
|
|
|
|
// Extract double from std::complex<double>; is identity otherwise
|
|
// TODO: Write in more idiomatic C++17
|
|
template <typename T>
|
|
struct scalar_value_type {
|
|
using type = T;
|
|
};
|
|
template <typename T>
|
|
struct scalar_value_type<std::complex<T>> {
|
|
using type = T;
|
|
};
|
|
template <typename T>
|
|
struct scalar_value_type<c10::complex<T>> {
|
|
using type = T;
|
|
};
|
|
|
|
} // namespace c10
|
|
|
|
namespace std {
|
|
|
|
template <typename T>
|
|
class numeric_limits<c10::complex<T>> : public numeric_limits<T> {};
|
|
|
|
} // namespace std
|