![]() |
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.
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/.
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]) |