File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
paddle/phi/core/framework Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,26 @@ namespace phi {
3030template <typename InType, typename OutType>
3131struct CastDataTypeFunctor {
3232 HOSTDEVICE inline OutType operator ()(InType in) const {
33+ #if defined(_MSC_VER)
34+ // Avoid unsupported convert of float/bfloat8/float16 -> complex
35+ if constexpr (
36+ (std::is_same_v<OutType, phi::dtype::complex <float >> ||
37+ std::is_same_v<
38+ OutType,
39+ phi::dtype::complex <
40+ double >>)&&(std::is_same_v<InType,
41+ phi::dtype::float8_e4m3fn> ||
42+ std::is_same_v<InType, phi::dtype::float8_e5m2> ||
43+ std::is_same_v<InType, phi::dtype::bfloat16> ||
44+ std::is_same_v<InType, phi::dtype::float16>)) {
45+ // default value,only to avoid compile error
46+ return OutType (0 );
47+ } else {
48+ return static_cast <OutType>(in);
49+ }
50+ #else
3351 return static_cast <OutType>(in);
52+ #endif
3453 }
3554};
3655
You can’t perform that action at this time.
0 commit comments