AIfES 2
2.0.0
|
Math functions for F32 data type using AVR pgmspace.h library for constant data storage. More...
Go to the source code of this file.
Functions | |
void | aimath_f32_avr_pgm_linear (const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result) |
Performs a matrix multiplication of F32 matrices a and b and adds a vector c to each row. More... | |
Math functions for F32 data type using AVR pgmspace.h library for constant data storage.
These functions modify the default implementation of the F32 math functions to work with parameters, stored in the program memory of AVR controllers.
The library avr/pgmspace.h is required.
void aimath_f32_avr_pgm_linear | ( | const aitensor_t * | a, |
const aitensor_t * | b, | ||
const aitensor_t * | c, | ||
aitensor_t * | result | ||
) |
Performs a matrix multiplication of F32 matrices a and b and adds a vector c to each row.
The data of b and c must be defined constant in PROGMEM.
Same functionality as aimath_f32_default_linear().
The addition of the horizontal vector c is performed via broadcast, i.e. element wise in each column Mathematically this broadcast is equal to multiplying c with an vertical vector (with the same number of elements as c) and adding the result to a * b
\[ result = a \cdot b + \left( \begin{array}{c} 1 \\ 1 \\ \vdots \\ 1 \\ \end{array}\right) \cdot c \]
Example:
*a | F32 matrix a (2D tensor of shape [N x K]) |
*b | F32 matrix b (2D tensor of shape [K x M]) (data const in PROGMEM) |
*c | F32 vector c (2D tensor of shape [1 x M]) (data const in PROGMEM) |
*result | Resulting F32 matrix (2D tensor of shape [N x M]) |