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

Function do_copy_diff_q4_q4

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

Source from the content-addressed store, hash-verified

290}
291
292void do_copy_diff_q4_q4(const TensorND& dst, const TensorND& src) {
293 auto isrc = tensor_iter_valonly<DTypeTrait<dtype::QuantizedS4>::ctype>(src).begin();
294 auto idst = tensor_iter_valonly<DTypeTrait<dtype::QuantizedS4>::ctype>(dst).begin();
295 auto src_dt_parm = src.layout.dtype.param<dtype::QuantizedS4>();
296 auto dst_dt_parm = dst.layout.dtype.param<dtype::QuantizedS4>();
297 for (size_t i = 0, it = dst.layout.total_nr_elems(); i < it; ++i) {
298 *idst = dst_dt_parm.quantize(src_dt_parm.dequantize(int8_t(*isrc)));
299 ++idst;
300 ++isrc;
301 }
302}
303
304void do_copy_diff_qu4_qu4(const TensorND& dst, const TensorND& src) {
305 auto isrc =

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