CMSIS-NN  
CMSIS NN Software Library
 
Loading...
Searching...
No Matches
Softmax Functions

Functions

arm_cmsis_nn_status arm_softmax_f32 (const float32_t *input, int32_t num_rows, int32_t row_size, float32_t *output)
 Softmax using the float-native API signature.
 
arm_cmsis_nn_status arm_softmax_f16 (const float16_t *input, int32_t num_rows, int32_t row_size, float16_t *output)
 Softmax using the float-native API signature.
 
void arm_nn_softmax_1x2_f16 (const float16_t in[2], float16_t out[2])
 Specialized softmax helper for a single float32 row of length 2.
 
void arm_nn_softmax_1x2_f32 (const float32_t in[2], float32_t out[2])
 Specialized softmax helper for a single float32 row of length 2.
 
arm_cmsis_nn_status arm_softmax_s16 (const int16_t *input, const int32_t num_rows, const int32_t row_size, const int32_t mult, const int32_t shift, const cmsis_nn_softmax_lut_s16 *softmax_params, int16_t *output)
 S16 softmax function.
 
void arm_softmax_s8 (const int8_t *input, const int32_t num_rows, const int32_t row_size, const int32_t mult, const int32_t shift, const int32_t diff_min, int8_t *output)
 S8 softmax function.
 
void arm_softmax_s8_s16 (const int8_t *input, const int32_t num_rows, const int32_t row_size, const int32_t mult, const int32_t shift, const int32_t diff_min, int16_t *output)
 S8 to s16 softmax function.
 
void arm_softmax_u8 (const uint8_t *input, const int32_t num_rows, const int32_t row_size, const int32_t mult, const int32_t shift, const int32_t diff_min, uint8_t *output)
 U8 softmax function.
 

Description

Function Documentation

◆ arm_nn_softmax_1x2_f16()

void arm_nn_softmax_1x2_f16 ( const float16_t  in[2],
float16_t  out[2] 
)

Specialized softmax helper for a single float32 row of length 2.

◆ arm_nn_softmax_1x2_f32()

void arm_nn_softmax_1x2_f32 ( const float32_t  in[2],
float32_t  out[2] 
)

Specialized softmax helper for a single float32 row of length 2.

◆ arm_softmax_f16()

arm_cmsis_nn_status arm_softmax_f16 ( const float16_t *  input,
int32_t  num_rows,
int32_t  row_size,
float16_t *  output 
)

Softmax using the float-native API signature.

Parameters
[in]inputPointer to the input matrix stored as num_rows rows of row_size values.
[in]num_rowsNumber of rows in the input matrix.
[in]row_sizeNumber of columns per row.
[out]outputPointer to the output matrix.
Returns
ARM_CMSIS_NN_SUCCESS on success or ARM_CMSIS_NN_ARG_ERROR on invalid arguments.

◆ arm_softmax_f32()

arm_cmsis_nn_status arm_softmax_f32 ( const float32_t input,
int32_t  num_rows,
int32_t  row_size,
float32_t output 
)

Softmax using the float-native API signature.

Parameters
[in]inputPointer to the input matrix stored as num_rows rows of row_size values.
[in]num_rowsNumber of rows in the input matrix.
[in]row_sizeNumber of columns per row.
[out]outputPointer to the output matrix.
Returns
ARM_CMSIS_NN_SUCCESS on success or ARM_CMSIS_NN_ARG_ERROR on invalid arguments.

◆ arm_softmax_s16()

arm_cmsis_nn_status arm_softmax_s16 ( const int16_t *  input,
const int32_t  num_rows,
const int32_t  row_size,
const int32_t  mult,
const int32_t  shift,
const cmsis_nn_softmax_lut_s16 softmax_params,
int16_t *  output 
)

S16 softmax function.

Parameters
[in]inputPointer to the input tensor
[in]num_rowsNumber of rows in the input tensor
[in]row_sizeNumber of elements in each input row
[in]multInput quantization multiplier
[in]shiftInput quantization shift within the range [0, 31]
[in]softmax_paramsSoftmax s16 layer parameters with two pointers to LUTs speficied below. For indexing the high 9 bits are used and 7 remaining for interpolation. That means 512 entries for the 9-bit indexing and 1 extra for interpolation, i.e. 513 values for each LUT.
  • Lookup table for exp(x), where x uniform distributed between [-10.0 , 0.0]
  • Lookup table for 1 / (1 + x), where x uniform distributed between [0.0 , 1.0]
[out]outputPointer to the output tensor
Returns
The function returns ARM_CMSIS_NN_ARG_ERROR Argument error check failed ARM_CMSIS_NN_SUCCESS - Successful operation
Note
Supported framework: TensorFlow Lite micro (bit-accurate)

◆ arm_softmax_s8()

void arm_softmax_s8 ( const int8_t *  input,
const int32_t  num_rows,
const int32_t  row_size,
const int32_t  mult,
const int32_t  shift,
const int32_t  diff_min,
int8_t *  output 
)

S8 softmax function.

Parameters
[in]inputPointer to the input tensor
[in]num_rowsNumber of rows in the input tensor
[in]row_sizeNumber of elements in each input row
[in]multInput quantization multiplier
[in]shiftInput quantization shift within the range [0, 31]
[in]diff_minMinimum difference with max in row. Used to check if the quantized exponential operation can be performed
[out]outputPointer to the output tensor
Note
Supported framework: TensorFlow Lite micro (bit-accurate)

◆ arm_softmax_s8_s16()

void arm_softmax_s8_s16 ( const int8_t *  input,
const int32_t  num_rows,
const int32_t  row_size,
const int32_t  mult,
const int32_t  shift,
const int32_t  diff_min,
int16_t *  output 
)

S8 to s16 softmax function.

Parameters
[in]inputPointer to the input tensor
[in]num_rowsNumber of rows in the input tensor
[in]row_sizeNumber of elements in each input row
[in]multInput quantization multiplier
[in]shiftInput quantization shift within the range [0, 31]
[in]diff_minMinimum difference with max in row. Used to check if the quantized exponential operation can be performed
[out]outputPointer to the output tensor
Note
Supported framework: TensorFlow Lite micro (bit-accurate)

◆ arm_softmax_u8()

void arm_softmax_u8 ( const uint8_t *  input,
const int32_t  num_rows,
const int32_t  row_size,
const int32_t  mult,
const int32_t  shift,
const int32_t  diff_min,
uint8_t *  output 
)

U8 softmax function.

Parameters
[in]inputPointer to the input tensor
[in]num_rowsNumber of rows in the input tensor
[in]row_sizeNumber of elements in each input row
[in]multInput quantization multiplier
[in]shiftInput quantization shift within the range [0, 31]
[in]diff_minMinimum difference with max in row. Used to check if the quantized exponential operation can be performed
[out]outputPointer to the output tensor
Note
Supported framework: TensorFlow Lite micro (bit-accurate)