| 32 | } |
| 33 | |
| 34 | void BFloat16ToFloat(const bfloat16* src, float* dst, int64 size) { |
| 35 | const uint16_t* p = reinterpret_cast<const uint16_t*>(src); |
| 36 | uint16_t* q = reinterpret_cast<uint16_t*>(dst); |
| 37 | #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 38 | for (; size != 0; p++, q += 2, size--) { |
| 39 | q[0] = *p; |
| 40 | q[1] = 0; |
| 41 | } |
| 42 | #else |
| 43 | for (; size != 0; p++, q += 2, size--) { |
| 44 | q[0] = 0; |
| 45 | q[1] = *p; |
| 46 | } |
| 47 | #endif |
| 48 | } |
| 49 | |
| 50 | } // end namespace tensorflow |
no outgoing calls