MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / DataTypeNumAlign

Function DataTypeNumAlign

paddle/fluid/framework/data_type.cc:110–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110int 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
127proto::VarType::Type PromoteTypesIfComplexExists(

Callers 1

Calls 1

DataTypeToStringFunction · 0.70

Tested by

no test coverage detected