MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / gen

Method gen

dnn/test/common/rng.cpp:87–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void Float16PeriodicalRNG::gen(const TensorND& tensor) {
88 megdnn_assert(tensor.layout.dtype == dtype::Float16());
89 size_t nr_elems = tensor.layout.span().dist_elem();
90 auto offset = tensor.layout.span().low_elem;
91 for (size_t i = 0; i < nr_elems; ++i) {
92 tensor.ptr<dt_float16>()[offset + i] = get_single_val();
93 }
94}
95
96dt_float16 Float16PeriodicalRNG::get_single_val() {
97 if (m_offset >= m_sequence.size()) {

Callers 6

init_naive_valuesMethod · 0.45
init_host_valuesMethod · 0.45
execMethod · 0.45
makeMethod · 0.45
init_host_valuesMethod · 0.45
TESTFunction · 0.45

Calls 14

maxFunction · 0.85
dist_elemMethod · 0.80
spanMethod · 0.80
access_bytesMethod · 0.80
cbFunction · 0.50
minFunction · 0.50
total_nr_elemsMethod · 0.45
enumvMethod · 0.45
raw_ptrMethod · 0.45
as_uint8Method · 0.45
quantizeMethod · 0.45

Tested by

no test coverage detected