AIfES 2  2.0.0
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_tailayer_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_tailayer_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

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
*layerThe layer to initialize.
*input_layerThe 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
*selfLayer 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
*selfLayer 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
*selfLayer to calculate the forward path for.

◆ ailayer_template_print_specs()

void ailayer_template_print_specs ( const ailayer_t self)

Print the layer specification.

Parameters
*selfThe 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
*selfThe layer to set the memory fields for.
*memory_ptrPointer 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
*selfThe layer to set the memory fields for.
*memory_ptrPointer 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
*selfThe 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
*selfThe layer to calculate the gradient memory size for.
Returns
Calculated gradient memory size in bytes.