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

Method read

dnn/src/common/reduce_helper_device.h:189–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187 const src_ctype scale;
188
189 MEGDNN_HOST MEGDNN_DEVICE wtype read(uint32_t idx) {
190 size_t x = idx / B;
191 size_t y = idx % B;
192 if (y < srcs_total_nr_elems[x]) {
193#if defined(__CUDA_ARCH__)
194 wtype val = isfinite(srcs[x][y]);
195#else
196 wtype val = std::isfinite(srcs[x][y]);
197#endif
198 if (val)
199 srcs[x][y] *= scale;
200 return !val;
201 }
202 return 0;
203 }
204 MEGDNN_HOST MEGDNN_DEVICE void write(uint32_t idx, wtype val) { dst[idx] = val; }
205 static MEGDNN_HOST MEGDNN_DEVICE wtype apply(wtype lhs, wtype rhs) {
206 return lhs | rhs;

Callers

nothing calls this directly

Calls 1

isfiniteFunction · 0.50

Tested by

no test coverage detected