SSCMA-Micro CPP SDK  v2.0.0
SSCMA-Micro is a cross-platform machine learning inference framework designed for embedded devices.
ma_math_vectors.h
Go to the documentation of this file.
1 #ifndef _MA_MATH_VECTORS_H_
2 #define _MA_MATH_VECTORS_H_
3 
4 #include <cstddef>
5 #include <cstdint>
6 
7 #if MA_USE_LIB_XTENSOR
8 #include <xtensor/xarray.hpp>
9 #include <xtensor/xmath.hpp>
10 #include <xtensor/xview.hpp>
11 #endif
12 
13 namespace ma::math {
14 
15 void softmax(float* data, size_t size);
16 
17 void fastSoftmax(float* data, size_t size);
18 
19 #if MA_USE_LIB_XTENSOR
20 template <typename QT>
21 static void dequantizeValues1D(xt::xarray<float>& dequantized_outputs, int index, const xt::xarray<QT>& quantized_outputs, size_t dim1, float32_t qp_scale, float32_t qp_zp) {
22  for (size_t i = 0; i < dim1; ++i) {
23  dequantized_outputs(i) = (float(quantized_outputs(index, i)) - qp_zp) * qp_scale;
24  }
25 }
26 #endif
27 
28 } // namespace ma::math
29 
30 #endif
Definition: ma_math_matrix.cpp:6
void softmax(float *data, size_t size)
Definition: ma_math_vectors.cpp:39
void fastSoftmax(float *data, size_t size)
Definition: ma_math_vectors.cpp:41