| 19 | template <typename T> |
| 20 | void scalar_quantize_normal( |
| 21 | T* __restrict__ result, |
| 22 | const float* __restrict__ vec0, |
| 23 | size_t dim, |
| 24 | float lo, |
| 25 | float delta |
| 26 | ) { |
| 27 | float one_over_delta = 1.0F / delta; |
| 28 | |
| 29 | ConstRowMajorArrayMap<float> v0(vec0, 1, static_cast<long>(dim)); |
| 30 | RowMajorArrayMap<T> res(result, 1, dim); |
| 31 | |
| 32 | // round to nearest integer, then cast to integer |
| 33 | res = ((v0 - lo) * one_over_delta).round().template cast<T>(); |
| 34 | } |
| 35 | |
| 36 | template <typename T> |
| 37 | void scalar_quantize_optimized( |
| 38 | T* __restrict__ result, |
no outgoing calls
no test coverage detected