| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#include <assert.h> |
| 11 |
|
| 12 |
#include "xnnpack/common.h" |
| 13 |
#include "xnnpack/math.h" |
| 14 |
#include "xnnpack/vcvt.h" |
| 15 |
|
| 16 |
|
| 17 |
void xnn_qs8_f32_vcvt_ukernel__scalar_u1( |
| 18 |
size_t batch, |
| 19 |
const int8_t* input, |
| 20 |
float* output, |
| 21 |
const struct xnn_qs8_f32_cvt_params params[restrict XNN_MIN_ELEMENTS(1)]) |
| 22 |
{ |
| 23 |
assert(batch != 0); |
| 24 |
assert(batch % sizeof(int8_t) == 0); |
| 25 |
assert(input != NULL); |
| 26 |
assert(output != NULL); |
| 27 |
|
| 28 |
const int32_t vzero_point = params->scalar.zero_point; |
| 29 |
const float vscale = params->scalar.scale; |
| 30 |
|
| 31 |
do { |
| 32 |
int32_t vx = *input++; |
| 33 |
vx -= vzero_point; |
| 34 |
|
| 35 |
float vy = (float) vx; |
| 36 |
vy *= vscale; |
| 37 |
*output++ = vy; |
| 38 |
|
| 39 |
batch -= sizeof(int8_t); |
| 40 |
} while (batch != 0); |
| 41 |
} |