| AIfES 2 2.0.0

Functions
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_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. More...

## Detailed Description

AVR PGM implementation of the Leaky ReLU layer .

Version
  2.2.0

Copyright
  Copyright (C) 2020-2023 Fraunhofer Institute for Microelectronic Circuits and Systems. All rights reserved.
  AIfES is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
  You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

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)
};
ailayer_leaky_relu_q7
Data-type specific Leaky ReLU layer struct for Q7 .
Definition: ailayer_leaky_relu_default.h:69
ailayer_leaky_relu_q7::alpha
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_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.

Parameters

  *layer | The layer structure to initialize.
  *input_layer | The prior layer.

Returns
  The (successfully) initialized layer structure.