未验证 提交 443ee03b 编写于 作者: Z zhangyang0701 提交者: GitHub

Merge pull request #1382 from qnqinan/develop

fix a bug in FPGA track
...@@ -22,7 +22,7 @@ namespace paddle_mobile { ...@@ -22,7 +22,7 @@ namespace paddle_mobile {
namespace fpga { namespace fpga {
int16_t fp32_2_fp16(float fp32_num) { int16_t fp32_2_fp16(float fp32_num) {
int32_t tmp = *(reinterpret_cast<int32_t *>)(&fp32_num); int32_t tmp = *(reinterpret_cast<int32_t *>(&fp32_num));
int16_t se_fp32 = (tmp >> 23) & 0x1ff; int16_t se_fp32 = (tmp >> 23) & 0x1ff;
int32_t m_fp32 = tmp & 0x007fffff; int32_t m_fp32 = tmp & 0x007fffff;
int16_t se_fp16 = 0; int16_t se_fp16 = 0;
...@@ -112,7 +112,7 @@ float fp16_2_fp32(int16_t fp16_num) { ...@@ -112,7 +112,7 @@ float fp16_2_fp32(int16_t fp16_num) {
} }
int32_t tmp = e_fp32 + m_fp32; int32_t tmp = e_fp32 + m_fp32;
float fp32_num = *(reinterpret_cast<float *>)&tmp; float fp32_num = *(reinterpret_cast<float *>(&tmp));
return fp32_num; return fp32_num;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册