diff --git a/paddle/phi/common/bfloat16.h b/paddle/phi/common/bfloat16.h index ccaf9b82bc5a5..028851e34c8bc 100644 --- a/paddle/phi/common/bfloat16.h +++ b/paddle/phi/common/bfloat16.h @@ -157,7 +157,9 @@ struct PADDLE_ALIGN(2) bfloat16 { uint16_t temp = x; uint16_t* temp_ptr = reinterpret_cast(&temp); res = *temp_ptr; - return res; + // return res; + res = res << 16; + return *reinterpret_cast(&res); #else #ifdef PADDLE_CUDA_BF16 return __bfloat162float(*reinterpret_cast(&x));