| AIfES 2 2.0.0

Typedefs | Functions
ailoss_mse_default.h File Reference

Default implementation of the Mean Squared Error loss . More...

Go to the source code of this file.

## Typedefs
typedef struct ailoss_mse | ailoss_mse_f32_t
typedef struct ailoss_mse | ailoss_mse_q31_t
typedef struct ailoss_mse | ailoss_mse_q7_t

## Functions
ailoss_t * | ailoss_mse_f32_default (ailoss_mse_f32_t *loss, ailayer_t *input_layer)
| Initializes and connect a Mean Squared Error loss with the F32 default implementation using a mean reduction. More...
ailoss_t * | ailoss_mse_sum_f32_default (ailoss_mse_q31_t *loss, ailayer_t *input_layer)
| Initializes and connect a Mean Squared Error loss with the F32 default implementation using a sum reduction. More...
ailoss_t * | ailoss_mse_mean_f32_default (ailoss_mse_q31_t *loss, ailayer_t *input_layer)
| Initializes and connect a Mean Squared Error loss with the F32 default implementation using a mean reduction. More...
ailoss_t * | ailoss_mse_q31_default (ailoss_mse_q31_t *loss, ailayer_t *input_layer)
| Initializes and connect a Mean Squared Error loss with the Q31 default implementation using a mean reduction. More...
ailoss_t * | ailoss_mse_sum_q31_default (ailoss_mse_q31_t *loss, ailayer_t *input_layer)
| Initializes and connect a Mean Squared Error loss with the Q31 default implementation using a sum reduction. More...
ailoss_t * | ailoss_mse_mean_q31_default (ailoss_mse_q31_t *loss, ailayer_t *input_layer)
| Initializes and connect a Mean Squared Error loss with the Q31 default implementation using a mean reduction. More...

## Detailed Description

Default implementation of the Mean Squared Error loss .

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/.

Hardware independent implementations of the Mean Squared Error loss in F32 and Q31 data-type. For more information about the Mean Squared Error loss refer to ailoss_mse.h.

## Function Documentation

## ◆ ailoss_mse_f32_default()

ailoss_t* ailoss_mse_f32_default | ( | ailoss_mse_f32_t * | loss,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a Mean Squared Error loss with the F32 default implementation using a mean reduction.

Example: Create the loss structure:

ailoss_mse_f32_t mse_loss;
ailoss_mse
General Mean Squared Error (MSE) loss struct.
Definition: ailoss_mse.h:50

Example: Initialize and connect the loss to the layer structure:

aimodel_t model;
...
model.loss = ailoss_mse_f32_default(&mse_loss, model.output_layer);
ailoss_mse_f32_default
ailoss_t * ailoss_mse_f32_default(ailoss_mse_f32_t *loss, ailayer_t *input_layer)
Initializes and connect a Mean Squared Error loss with the F32 default implementation using a mean ...
aimodel
AIfES artificial neural network model.
Definition: aifes_core.h:181
aimodel::output_layer
ailayer_t * output_layer
Output layer of the model.
Definition: aifes_core.h:183
aimodel::loss
ailoss_t * loss
The loss or cost function of the model (only for training).
Definition: aifes_core.h:188

Parameters

  *loss | The loss structure to initialize.
  *input_layer | The output layer of the model.

Returns
  The (successfully) initialized loss structure.

## ◆ ailoss_mse_mean_f32_default()

ailoss_t* ailoss_mse_mean_f32_default | ( | ailoss_mse_q31_t * | loss,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a Mean Squared Error loss with the F32 default implementation using a mean reduction.

Example: Create the loss structure:

ailoss_mse_f32_t mse_loss;

Example: Initialize and connect the loss to the layer structure:

aimodel_t model;
...
model.loss = ailoss_mse_f32_default(&mse_loss, model.output_layer);

Parameters

  *loss | The loss structure to initialize.
  *input_layer | The output layer of the model.

Returns
  The (successfully) initialized loss structure.

## ◆ ailoss_mse_mean_q31_default()

ailoss_t* ailoss_mse_mean_q31_default | ( | ailoss_mse_q31_t * | loss,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a Mean Squared Error loss with the Q31 default implementation using a mean reduction.

Example: Create the loss structure:

ailoss_mse_q31_t mse_loss;

Example: Initialize and connect the loss to the layer structure:

aimodel_t model;
...
model.loss = ailoss_mse_q31_default(&mse_loss, model.output_layer);
ailoss_mse_q31_default
ailoss_t * ailoss_mse_q31_default(ailoss_mse_q31_t *loss, ailayer_t *input_layer)
Initializes and connect a Mean Squared Error loss with the Q31 default implementation using a mean ...

Parameters

  *loss | The loss structure to initialize.
  *input_layer | The output layer of the model.

Returns
  The (successfully) initialized loss structure.

## ◆ ailoss_mse_q31_default()

ailoss_t* ailoss_mse_q31_default | ( | ailoss_mse_q31_t * | loss,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a Mean Squared Error loss with the Q31 default implementation using a mean reduction.

Example: Create the loss structure:

ailoss_mse_q31_t mse_loss;

Example: Initialize and connect the loss to the layer structure:

aimodel_t model;
...
model.loss = ailoss_mse_q31_default(&mse_loss, model.output_layer);

Parameters

  *loss | The loss structure to initialize.
  *input_layer | The output layer of the model.

Returns
  The (successfully) initialized loss structure.

## ◆ ailoss_mse_sum_f32_default()

ailoss_t* ailoss_mse_sum_f32_default | ( | ailoss_mse_q31_t * | loss,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a Mean Squared Error loss with the F32 default implementation using a sum reduction.

Example: Create the loss structure:

ailoss_mse_f32_t mse_loss;

Example: Initialize and connect the loss to the layer structure:

aimodel_t model;
...
model.loss = ailoss_mse_f32_default(&mse_loss, model.output_layer);

Parameters

  *loss | The loss structure to initialize.
  *input_layer | The output layer of the model.

Returns
  The (successfully) initialized loss structure.

## ◆ ailoss_mse_sum_q31_default()

ailoss_t* ailoss_mse_sum_q31_default | ( | ailoss_mse_q31_t * | loss,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a Mean Squared Error loss with the Q31 default implementation using a sum reduction.

Example: Create the loss structure:

ailoss_mse_q31_t mse_loss;

Example: Initialize and connect the loss to the layer structure:

aimodel_t model;
...
model.loss = ailoss_mse_q31_default(&mse_loss, model.output_layer);

Parameters

  *loss | The loss structure to initialize.
  *input_layer | The output layer of the model.

Returns
  The (successfully) initialized loss structure.