AIfES 2  2.0.0
ailayer_leaky_relu_avr_pgm.h File Reference

AVR PGM implementation of the Leaky ReLU layer . More...

Go to the source code of this file.

Functions

ailayer_tailayer_leaky_relu_q7_avr_pgm (ailayer_leaky_relu_q7_t *layer, ailayer_t *input_layer)
 Initializes and connect a Leaky ReLU layer with the Q7 AVR PGM implementation. More...
 

Detailed Description

AVR PGM implementation of the Leaky ReLU layer .

Version
2.2.0

AVR controller specific implementation of the Leaky ReLU layer in Q7 data-type. For more information about the Leaky ReLU layer refer to ailayer_leaky_relu.h.

Requires avr/pgmspace.h library

Function Documentation

◆ ailayer_leaky_relu_q7_avr_pgm()

ailayer_t* ailayer_leaky_relu_q7_avr_pgm ( ailayer_leaky_relu_q7_t layer,
ailayer_t input_layer 
)

Initializes and connect a Leaky ReLU layer with the Q7 AVR PGM implementation.

The quantization parameters of the result tensor of the input layer must be defined constant in program memory (PROGMEM). The layer configuration is the same as with ailayer_leaky_relu_q7_default().

The quantization parameters of the result tensor are automatically set to {shift = input_layer.result.shift, zero_point = input_layer.result.zero_point} because the output values are in the interval (alpha * min(input_layer.result), max(input_layer.result)].

Example: Create the layer structure of a pre-trained model (qparams must be set manually):
In C:

ailayer_leaky_relu_q7_t leaky_relu_layer = {
.alpha = AISCALAR_Q7(0.01f, 7, 0)
};
Data-type specific Leaky ReLU layer struct for Q7 .
Definition: ailayer_leaky_relu_default.h:69
aiscalar_q7_t alpha
Data type-specific parameter used to calculate Leaky ReLU function for input values < 0.
Definition: ailayer_leaky_relu_default.h:71

In C, C++ and on Arduino:

ailayer_leaky_relu_q7_t leaky_relu_layer = AILAYER_LEAKY_RELU_Q7_M(AISCALAR_Q7(0.01f, 7, 0));

Example: Initialize and connect the layer:

x = ailayer_leaky_relu_q7_avr_pgm(&leaky_relu_layer, x);
ailayer_t * ailayer_leaky_relu_q7_avr_pgm(ailayer_leaky_relu_q7_t *layer, ailayer_t *input_layer)
Initializes and connect a Leaky ReLU layer with the Q7 AVR PGM implementation.
Parameters
*layerThe layer structure to initialize.
*input_layerThe prior layer.
Returns
The (successfully) initialized layer structure.