| AIfES 2 2.0.0

Data Structures | Typedefs | Functions | Variables
ailayer_template.h File Reference

[DEPRECATED] This file acts as a reference for new layer structures. Some of the shown functions are mandatory, some are optional. More...

Go to the source code of this file.

## Data Structures
struct | ailayer_template
| Template for general AIfES layers. More...

## Typedefs
typedef struct ailayer_template | ailayer_template_t

## Functions
ailayer_t * | ailayer_template (ailayer_template_t *layer, ailayer_t *input_layer)
| Initialize the given layer struct - mandatory More...
void | ailayer_template_forward (ailayer_t *self)
| Calculate the forward path for given layer - mandatory More...
void | ailayer_template_backward (ailayer_t *self)
| Calculate the backward (training) path for the given layer - depends on usability in training More...
void | ailayer_template_calc_result_shape (ailayer_t *self)
| Calculate the shape of the result tensor. More...
uint32_t | ailayer_template_sizeof_paramem (const ailayer_t *self)
| Calculate and return the parameter memory size needed for this layer - mandatory for hidden layers More...
void | ailayer_template_set_paramem (ailayer_t *self, void *memory_ptr)
| Distribute provided memory to the parameter pointers - mandatory for hidden layers More...
uint32_t | ailayer_template_sizeof_trainmem (const ailayer_t *self)
| Calculate and return the necessary memory size needed by this layer for training - mandatory for hidden layers More...
void | ailayer_template_set_trainmem (ailayer_t *self, void *memory_ptr)
| Distribute provided memory to the training gradients pointers - mandatory for hidden layers More...
void | ailayer_template_print_specs (const ailayer_t *self)
| Print the layer specification. More...

## Variables
const aicore_layertype_t * | ailayer_template_type

## Detailed Description

[DEPRECATED] This file acts as a reference for new layer structures. Some of the shown functions are mandatory, some are optional.

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

## Function Documentation

## ◆ ailayer_template()

ailayer_t* ailayer_template | ( | ailayer_template_t * | layer,
|  | ailayer_t * | input_layer
| ) |  |

Initialize the given layer struct - mandatory

Initializes and sets all parameters needed by the layer structure.

Parameters

  *layer | The layer to initialize.
  *input_layer | The layer that provides the inputs to the initialized layer.

Returns
  Pointer to the (successfully) initialized layer structure.

## ◆ ailayer_template_backward()

void ailayer_template_backward | ( | ailayer_t * | self | ) |

Calculate the backward (training) path for the given layer - depends on usability in training

Parameters

  *self | Layer to calculate the backward path for.

## ◆ ailayer_template_calc_result_shape()

void ailayer_template_calc_result_shape | ( | ailayer_t * | self | ) |

Calculate the shape of the result tensor.

Parameters

  *self | Layer to calculate the resulting shape for.

## ◆ ailayer_template_forward()

void ailayer_template_forward | ( | ailayer_t * | self | ) |

Calculate the forward path for given layer - mandatory

Parameters

  *self | Layer to calculate the forward path for.

## ◆ ailayer_template_print_specs()

void ailayer_template_print_specs | ( | const ailayer_t * | self | ) |

Print the layer specification.

Parameters

  *self | The layer to print the specification for

## ◆ ailayer_template_set_paramem()

void ailayer_template_set_paramem | ( | ailayer_t * | self,
|  | void * | memory_ptr
| ) |  |

Distribute provided memory to the parameter pointers - mandatory for hidden layers

Parameters

  *self | The layer to set the memory fields for.
  *memory_ptr | Pointer to the buffer provided for the layer parameters.

## ◆ ailayer_template_set_trainmem()

void ailayer_template_set_trainmem | ( | ailayer_t * | self,
|  | void * | memory_ptr
| ) |  |

Distribute provided memory to the training gradients pointers - mandatory for hidden layers

Parameters

  *self | The layer to set the memory fields for.
  *memory_ptr | Pointer to the buffer provided for the layer gradients.

## ◆ ailayer_template_sizeof_paramem()

uint32_t ailayer_template_sizeof_paramem | ( | const ailayer_t * | self | ) |

Calculate and return the parameter memory size needed for this layer - mandatory for hidden layers

Parameters

  *self | The layer to calculate the parameter memory size for

Returns
  Calculated parameter memory size in bytes.

## ◆ ailayer_template_sizeof_trainmem()

uint32_t ailayer_template_sizeof_trainmem | ( | const ailayer_t * | self | ) |

Calculate and return the necessary memory size needed by this layer for training - mandatory for hidden layers

Parameters

  *self | The layer to calculate the gradient memory size for.

Returns
  Calculated gradient memory size in bytes.