1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 9 #include "inttypes.h" 10 #include "stddef.h" 11 12 namespace impl { 13 namespace reference { 14 namespace kernels { 15 16 template <typename T> 17 T quantize(const float x, float scale, int32_t zero_point); 18 19 template <typename T> 20 float dequantize(const T x, float scale, int32_t zero_point); 21 22 template <typename T> 23 void quantize( 24 T* __restrict__ y, 25 const float* __restrict__ x, 26 float scale, 27 int32_t zero_point, 28 size_t size); 29 30 // Deuantize an int8_t/uint8_t/int16_t array to an fp32 array 31 template <typename T> 32 void dequantize( 33 float* __restrict__ y, 34 const T* __restrict__ x, 35 float scale, 36 int32_t zero_point, 37 size_t size); 38 39 }; // namespace kernels 40 }; // namespace reference 41 }; // namespace impl 42