MCPcopy Create free account
hub / github.com/MegEngine/MegCC / Float16PeriodicalRNG

Method Float16PeriodicalRNG

compiler/test/kernel/common/src/rng.cpp:274–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274Float16PeriodicalRNG::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
292Float16PeriodicalRNG::Float16PeriodicalRNG(size_t range) : m_offset(0) {
293 union U {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected