The softmax functions are exponential functions with base 2.
More...
|
| static void | hpm_nn_softmax_s8_fast (const q7_t *in_vec, const uint16_t size, q7_t *out_vec) |
| | This is a softmax function for signed 8-bit integer input vectors. More...
|
| |
| static void | hpm_nn_softmax_s16_fast (const q15_t *in_vec, const uint16_t size, q15_t *out_vec) |
| | This is a softmax function for signed 16-bit integer input vectors. More...
|
| |
| static void | hpm_nn_softmax_s8_hp (const int8_t *in_tensor, const int32_t in_tensor_row, const int32_t in_tensor_col, const int32_t scale, const int32_t lshift, const int32_t diff_min, int8_t *out_tensor) |
| | This is a softmax function for signed 8-bit integer input tensor with high precision algorithm. More...
|
| |
| static void | hpm_nn_softmax_u8_hp (const uint8_t *in_tensor, const int32_t in_tensor_row, const int32_t in_tensor_col, const int32_t scale, const int32_t lshift, const int32_t diff_min, uint8_t *out_tensor) |
| | This is a softmax function for unsigned 8-bit integer input tensor with high precision algorithm. More...
|
| |
The softmax functions are exponential functions with base 2.
◆ hpm_nn_softmax_s16_fast()
| static void hpm_nn_softmax_s16_fast |
( |
const q15_t * |
in_vec, |
|
|
const uint16_t |
size, |
|
|
q15_t * |
out_vec |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is a softmax function for signed 16-bit integer input vectors.
- Parameters
-
| [in] | in_vec | pointer of the input vector |
| [in] | size | number of elements in the input vector |
| [out] | out_vec | pointer of the output vector |
◆ hpm_nn_softmax_s8_fast()
| static void hpm_nn_softmax_s8_fast |
( |
const q7_t * |
in_vec, |
|
|
const uint16_t |
size, |
|
|
q7_t * |
out_vec |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is a softmax function for signed 8-bit integer input vectors.
- Parameters
-
| [in] | in_vec | pointer of the input vector |
| [in] | size | number of elements in the input vector |
| [out] | out_vec | pointer of the output vector |
Example:
#define LENGTH 10
q7_t in_data[LENGTH] = {...};
q7_t out_data[LENGTH];
static void hpm_nn_softmax_s8_fast(const q7_t *in_vec, const uint16_t size, q7_t *out_vec)
This is a softmax function for signed 8-bit integer input vectors.
Definition: hpm_math.h:15874
◆ hpm_nn_softmax_s8_hp()
| static void hpm_nn_softmax_s8_hp |
( |
const int8_t * |
in_tensor, |
|
|
const int32_t |
in_tensor_row, |
|
|
const int32_t |
in_tensor_col, |
|
|
const int32_t |
scale, |
|
|
const int32_t |
lshift, |
|
|
const int32_t |
diff_min, |
|
|
int8_t * |
out_tensor |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is a softmax function for signed 8-bit integer input tensor with high precision algorithm.
- Parameters
-
| [in] | in_tensor | pointer of the input tensor |
| [in] | in_tensor_row | number of rows in the input tensor |
| [in] | in_tensor_col | number of columns in the input tensor |
| [in] | scale | scaling value for input quantization |
| [in] | lshift | left shift amount for input quantization |
| [in] | diff_min | minimum threshold to perform the quantized exponential operation. The difference can be obtained by subtracting the input from the maximum in row. |
| [out] | out_tensor | pointer of the output tensor |
◆ hpm_nn_softmax_u8_hp()
| static void hpm_nn_softmax_u8_hp |
( |
const uint8_t * |
in_tensor, |
|
|
const int32_t |
in_tensor_row, |
|
|
const int32_t |
in_tensor_col, |
|
|
const int32_t |
scale, |
|
|
const int32_t |
lshift, |
|
|
const int32_t |
diff_min, |
|
|
uint8_t * |
out_tensor |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This is a softmax function for unsigned 8-bit integer input tensor with high precision algorithm.
- Parameters
-
| [in] | in_tensor | pointer of the input tensor |
| [in] | in_tensor_row | number of rows in the input tensor |
| [in] | in_tensor_col | number of columns in the input tensor |
| [in] | scale | scaling value for input quantization |
| [in] | lshift | left shift amount for input quantization |
| [in] | diff_min | minimum threshold to perform the quantized exponential operation. The difference can be obtained by subtracting the input from the maximum in row. |
| [out] | out_tensor | pointer of the output tensor |