From bc519edba234b98260b36540a6c0c68d9d804e45 Mon Sep 17 00:00:00 2001 From: zhouyaqiang Date: Sat, 4 Sep 2021 17:32:57 +0800 Subject: [PATCH] fix compile error --- mindspore/ccsrc/utils/complex.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mindspore/ccsrc/utils/complex.h b/mindspore/ccsrc/utils/complex.h index c7053ccc051..cd83ebfd8b7 100644 --- a/mindspore/ccsrc/utils/complex.h +++ b/mindspore/ccsrc/utils/complex.h @@ -63,12 +63,8 @@ struct alignas(sizeof(T) * 2) Complex { } #endif template - HOST_DEVICE explicit Complex(const std::enable_if_t::value, Complex> &other) - : real_(other.real()), imag_(other.imag()) {} - - template - HOST_DEVICE explicit Complex(const std::enable_if_t::value, Complex> &other) - : real_(other.real()), imag_(other.imag()) {} + HOST_DEVICE inline explicit Complex(const Complex &other) + : real_(static_cast(other.real())), imag_(static_cast(other.imag())) {} HOST_DEVICE inline explicit operator bool() const { return static_cast(real_) || static_cast(imag_); } HOST_DEVICE inline explicit operator signed char() const { return static_cast(real_); } @@ -87,7 +83,7 @@ struct alignas(sizeof(T) * 2) Complex { inline explicit operator float16() const { return static_cast(real_); } #endif - HOST_DEVICE inline constexpr Complex &operator=(const T &real) { + HOST_DEVICE inline Complex &operator=(const T &real) { real_ = real; imag_ = T(); return *this;