AIfES 2  2.0.0
ailayer_dense Struct Reference

General Dense layer structure. More...

#include <ailayer_dense.h>

Data Fields

ailayer_t base
 Inherited field members from general ailayer struct.
 
const aimath_dtype_tresult_dtype
 Data type of the inference result values.
 
uint16_t result_shape [2]
 Inference result tensor (ailayer.result) shape.
 
Layer configuration

Required configuration parameters for the layer

These fields have to be configured by the user before calling the initializer function.

uint32_t neurons
 Layer neurons count (number of outputs).
 
Trainable parameters

Data fields for the trainable parameters (weights, bias) of the layer

aitensor_t weights
 Tensor containing the layer weights.
 
aitensor_t bias
 Tensor containing the layer bias weights.
 
const aimath_dtype_tweights_dtype
 Data type of the weights.
 
const aimath_dtype_tbias_dtype
 Data type of the bias weights.
 
uint16_t weights_shape [2]
 Weights tensor shape (n x m matrix).
 
uint16_t bias_shape [2]
 Bias weights tensor shape (n x m matrix).
 
aitensor_ttrainable_params [2]
 Pointer to the weights and biases (which are the trainable parameters).
 
aitensor_tgradients [2]
 Gradients structure for the back propagation algorithm.
 
void * optimem [2]
 Memory field used by the trainings optimizer.
 
Math functions

Required data type specific math functions

void(* linear )(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)
 Required math function: Linear transformation. More...
 
void(* mat_mul )(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
 Required math function: Matrix multiplication. More...
 
void(* tensor_add )(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
 Required math function: Element wise tensor addition. More...
 

Detailed Description

General Dense layer structure.

Field Documentation

◆ linear

void(* linear) (const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)

Required math function: Linear transformation.

Requires a math function that performs a linear transformation:

\[ result = a \cdot b \oplus c = a \cdot b + \left( \begin{array}{c} 1 \\ \vdots \\ 1 \\ \end{array}\right) \cdot c \]

Parameters
aMatrix with dimension \( N \times K \) (input)
bMatrix with dimension \( K \times M \) (input)
cLaying vektor with dimension \( 1 \times M \) (input)
resultMatrix with dimension \( N \times M \) (output)

◆ mat_mul

void(* mat_mul) (const aitensor_t *a, const aitensor_t *b, aitensor_t *result)

Required math function: Matrix multiplication.

Requires a math function that performs a matrix multiplication on two 2D tensors:

\[ result = a \cdot b \]

Parameters
aMatrix with dimension \( N \times K \) (input)
bMatrix with dimension \( K \times M \) (input)
resultMatrix with dimension \( N \times M \) (output)

◆ tensor_add

void(* tensor_add) (const aitensor_t *a, const aitensor_t *b, aitensor_t *result)

Required math function: Element wise tensor addition.

Requires a math function that adds two tensors element wise:

\[ result = a + b \]


The documentation for this struct was generated from the following file: