| 272 | } |
| 273 | |
| 274 | Float16PeriodicalRNG::Float16PeriodicalRNG() : m_offset(0) { |
| 275 | for (size_t x = 0; x < (1u << 16); ++x) { |
| 276 | size_t exponent = (x >> 10) & 0x1F; |
| 277 | if (exponent == 0x1F) { |
| 278 | // +inf, -inf, NaN |
| 279 | continue; |
| 280 | } |
| 281 | union U { |
| 282 | U() {} |
| 283 | uint16_t i; |
| 284 | megdnn::dt_float16 f; |
| 285 | } i2f; |
| 286 | i2f.i = static_cast<uint16_t>(x); |
| 287 | m_sequence.push_back(i2f.f); |
| 288 | } |
| 289 | std::random_shuffle(m_sequence.begin(), m_sequence.end()); |
| 290 | } |
| 291 | |
| 292 | Float16PeriodicalRNG::Float16PeriodicalRNG(size_t range) : m_offset(0) { |
| 293 | union U { |
nothing calls this directly
no outgoing calls
no test coverage detected