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

Function do_copy_diff_u8_q8

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

Source from the content-addressed store, hash-verified

279}
280
281void do_copy_diff_u8_q8(const TensorND& dst, const TensorND& src) {
282 auto isrc = tensor_iter_valonly<DTypeTrait<dtype::Uint8>::ctype>(src).begin();
283 auto idst = tensor_iter_valonly<DTypeTrait<dtype::QuantizedS8>::ctype>(dst).begin();
284 auto dst_dt_parm = dst.layout.dtype.param<dtype::QuantizedS8>();
285 for (size_t i = 0, it = dst.layout.total_nr_elems(); i < it; ++i) {
286 *idst = dst_dt_parm.quantize((float)(*isrc) - 128.f);
287 ++idst;
288 ++isrc;
289 }
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();

Callers 1

execMethod · 0.85

Calls 3

beginMethod · 0.45
total_nr_elemsMethod · 0.45
quantizeMethod · 0.45

Tested by

no test coverage detected