MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / vquantize

Function vquantize

src/core/NEON/NEAsymm.h:620–636  ·  view source on GitHub ↗

Quantize a neon vector holding 8 floating point values. * * @param[in] qv Input values to be quantized. * @param[in] qi Quantization information to be used in the computation. * * @return A neon vector holding the quantized values */

Source from the content-addressed store, hash-verified

618 * @return A neon vector holding the quantized values
619 */
620inline uint8x8_t vquantize(const float32x4x2_t &qv, const UniformQuantizationInfo &qi)
621{
622 const float scale = qi.scale;
623 const int offset = qi.offset;
624 const float32x4_t voffset = vdupq_n_f32(offset);
625 const float32x4_t vinvscale = vdupq_n_f32(1.f / scale);
626 const int32x4x4_t rf = {{
627#ifdef __aarch64__
628 vcvtnq_s32_f32(vmlaq_f32(voffset, qv.val[0], vinvscale)),
629 vcvtnq_s32_f32(vmlaq_f32(voffset, qv.val[1], vinvscale)),
630#else //__aarch64__
631 vcvtq_s32_f32(vmlaq_f32(voffset, qv.val[0], vinvscale)),
632 vcvtq_s32_f32(vmlaq_f32(voffset, qv.val[1], vinvscale)),
633#endif //__aarch64__
634 }};
635 return vqmovun_s16(vcombine_s16(vqmovn_s32(rf.val[0]), vqmovn_s32(rf.val[1])));
636}
637
638/** Quantize a neon vector holding 8 floating point values.
639 *

Callers 2

vrequantize_poolingFunction · 0.50

Calls 1

vquantize_internalFunction · 0.85

Tested by

no test coverage detected