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

Function do_copy_diff_qu4_qu4

dnn/src/naive/relayout_format/opr_impl.cpp:304–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void do_copy_diff_qu4_qu4(const TensorND& dst, const TensorND& src) {
305 auto isrc =
306 tensor_iter_valonly<DTypeTrait<dtype::Quantized4Asymm>::ctype>(src).begin();
307 auto idst =
308 tensor_iter_valonly<DTypeTrait<dtype::Quantized4Asymm>::ctype>(dst).begin();
309 auto src_dt_parm = src.layout.dtype.param<dtype::Quantized4Asymm>();
310 auto dst_dt_parm = dst.layout.dtype.param<dtype::Quantized4Asymm>();
311 for (size_t i = 0, it = dst.layout.total_nr_elems(); i < it; ++i) {
312 *idst = dst_dt_parm.quantize(src_dt_parm.dequantize(uint8_t(*isrc)));
313 ++idst;
314 ++isrc;
315 }
316}
317
318void check_layout_and_canonize(TensorLayout& src, TensorLayout& dst) {
319 megdnn_assert(dst.is_non_overlapping_strong());

Callers 1

execMethod · 0.85

Calls 4

beginMethod · 0.45
total_nr_elemsMethod · 0.45
quantizeMethod · 0.45
dequantizeMethod · 0.45

Tested by

no test coverage detected