| 108 | } |
| 109 | |
| 110 | int DataTypeNumAlign(const proto::VarType::Type t) { |
| 111 | int cast_type_num = -1; |
| 112 | if (t == proto::VarType::FP32 || t == proto::VarType::FP64) { |
| 113 | cast_type_num = static_cast<int>(t) - 5; |
| 114 | } else if (t == proto::VarType::COMPLEX64 || |
| 115 | t == proto::VarType::COMPLEX128) { |
| 116 | cast_type_num = static_cast<int>(t) - 21; |
| 117 | } else { |
| 118 | PADDLE_THROW(common::errors::Unavailable( |
| 119 | "Only supports to align data type include float32, float64, complex64 " |
| 120 | "and complex128, but received data type is `s`.", |
| 121 | DataTypeToString(t))); |
| 122 | } |
| 123 | return cast_type_num; |
| 124 | } |
| 125 | |
| 126 | // Now only supports promotion of complex type |
| 127 | proto::VarType::Type PromoteTypesIfComplexExists( |
no test coverage detected