AIfES 2  2.0.0
ailayer_softsign_default.h File Reference

Default implementation of the Softsign layer . More...

Go to the source code of this file.

Typedefs

typedef struct ailayer_softsign ailayer_softsign_f32_t
 
typedef struct ailayer_softsign ailayer_softsign_q31_t
 
typedef struct ailayer_softsign ailayer_softsign_q7_t
 

Functions

ailayer_tailayer_softsign_f32_default (ailayer_softsign_f32_t *layer, ailayer_t *input_layer)
 Initializes and connect a Softsign layer with the F32 default implementation. More...
 
ailayer_tailayer_softsign_q31_default (ailayer_softsign_q31_t *layer, ailayer_t *input_layer)
 Initializes and connect a Softsign layer with the Q31 default implementation. More...
 
ailayer_tailayer_softsign_q7_default (ailayer_softsign_q7_t *layer, ailayer_t *input_layer)
 Initializes and connect a Softsign layer with the Q7 default implementation. More...
 
void ailayer_softsign_calc_result_tensor_params_q31_default (ailayer_t *self)
 Calculate and set the quantization parameters for the result tensor of the softsign Q31 default implementation. More...
 
void ailayer_softsign_calc_result_tensor_params_q7_default (ailayer_t *self)
 Calculate and set the quantization parameters for the result tensor of the softsign Q7 default implementation. More...
 

Detailed Description

Default implementation of the Softsign layer .

Version
2.2.0

Hardware independent implementations of the Softsign layer in F32 and Q7 data-type. For more information about the Softsign layer refer to ailayer_softsign.h.

Function Documentation

◆ ailayer_softsign_calc_result_tensor_params_q31_default()

void ailayer_softsign_calc_result_tensor_params_q31_default ( ailayer_t self)

Calculate and set the quantization parameters for the result tensor of the softsign Q31 default implementation.

Implementation of ailayer.calc_result_tensor_params.

The quantization parameters are pre-defined and the same as in the corresponding math function aimath_q31_default_softsign().

Parameters
*selfThe layer structure

◆ ailayer_softsign_calc_result_tensor_params_q7_default()

void ailayer_softsign_calc_result_tensor_params_q7_default ( ailayer_t self)

Calculate and set the quantization parameters for the result tensor of the softsign Q7 default implementation.

Implementation of ailayer.calc_result_tensor_params.

The quantization parameters are pre-defined and the same as in the corresponding math function aimath_q7_default_softsign().

Parameters
*selfThe layer structure

◆ ailayer_softsign_f32_default()

ailayer_t* ailayer_softsign_f32_default ( ailayer_softsign_f32_t layer,
ailayer_t input_layer 
)

Initializes and connect a Softsign layer with the F32 default implementation.

Example: Create the layer structure:

ailayer_softsign_f32_t softsign_layer;
General Softsign layer struct.
Definition: ailayer_softsign.h:48

or

ailayer_softsign_f32_t softsign_layer = AILAYER_SOTSIGN_F32();

Example: Initialize and connect the layer:

x = ailayer_softsign_f32_default(&softsign_layer, x);
ailayer_t * ailayer_softsign_f32_default(ailayer_softsign_f32_t *layer, ailayer_t *input_layer)
Initializes and connect a Softsign layer with the F32 default implementation.
Parameters
*layerThe layer structure to initialize.
*input_layerThe prior layer.
Returns
The (successfully) initialized layer structure.

◆ ailayer_softsign_q31_default()

ailayer_t* ailayer_softsign_q31_default ( ailayer_softsign_q31_t layer,
ailayer_t input_layer 
)

Initializes and connect a Softsign layer with the Q31 default implementation.

The quantization parameters of the result tensor are automatically set to {shift = 31, zero_point = 0} because the output values are in the interval (-1, 1).

Example: Create the layer structure:

ailayer_softsign_q31_t softsign_layer;

or

ailayer_softsign_q31_t softsign_layer = AILAYER_SOFTSIGN_Q31_M();

Example: Initialize and connect the layer:

x = ailayer_softsign_q31_default(&softsign_layer, x);
ailayer_t * ailayer_softsign_q31_default(ailayer_softsign_q31_t *layer, ailayer_t *input_layer)
Initializes and connect a Softsign layer with the Q31 default implementation.
Parameters
*layerThe layer structure to initialize.
*input_layerThe prior layer.
Returns
The (successfully) initialized layer structure.

◆ ailayer_softsign_q7_default()

ailayer_t* ailayer_softsign_q7_default ( ailayer_softsign_q7_t layer,
ailayer_t input_layer 
)

Initializes and connect a Softsign layer with the Q7 default implementation.

The quantization parameters of the result tensor are automatically set to {shift = 7, zero_point = 0} because the output values are in the interval (-1, 1).

Example: Create the layer structure:

ailayer_softsign_q7_t softsign_layer;

or

ailayer_softsign_q7_t softsign_layer = AILAYER_SOFTSIGN_Q7_M();

Example: Initialize and connect the layer:

x = ailayer_softsign_q7_default(&softsign_layer, x);
ailayer_t * ailayer_softsign_q7_default(ailayer_softsign_q7_t *layer, ailayer_t *input_layer)
Initializes and connect a Softsign layer with the Q7 default implementation.
Parameters
*layerThe layer structure to initialize.
*input_layerThe prior layer.
Returns
The (successfully) initialized layer structure.