| AIfES 2 2.0.0

Typedefs | Functions | Variables
aimath_u8.h File Reference

Definition of the U8 (aiu8) data-type. More...

Go to the source code of this file.

## Typedefs
typedef uint8_t | aiscalar_u8_t

## Functions
void | aimath_u8_print_aitensor (const aitensor_t *tensor)
| Printing a U8 tensor to console. More...
void | aimath_u8_print_aiscalar (const void *scalar)
| Printing a U8 scalar to console. More...

## Variables
const aimath_dtype_t * | aiu8
| The U8 data-type indicator. More...

## Detailed Description

Definition of the U8 (aiu8) data-type.

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

The U8 (aiu8) data-type stores data as 8 bit unsigned integer values. It does not require any additional parameter to define the values. This data-type is used for example for classification labels.

Example: Create a U8 tensor
The tensor

\[ \left( \begin{array}{rrr} 0 & 1 & 2 \\ 3 & 4 & 5 \end{array}\right) \]

can be created with In C:

uint8_t example_data[] = {0, 1, 2,
3, 4, 5};
uint16_t example_shape[] = {2, 3};
aitensor_t example_tensor = {
.dtype = aiu8,
.dim = 2,
.shape = example_shape,
.data = example_data
};
aiu8
const aimath_dtype_t * aiu8
The U8 data-type indicator.
aitensor
A tensor in AIfES.
Definition: aifes_math.h:89
aitensor::dtype
const aimath_dtype_t * dtype
The datatype of the tensor, e.g.
Definition: aifes_math.h:90

In C, C++ and on Arduino:

uint8_t example_data[] = {0, 1, 2,
3, 4, 5};
uint16_t example_shape[] = {2, 3};
aitensor_t example_tensor = AITENSOR_2D_U8(example_shape, example_data);

Example: Create a U8 scalar
Either create it as a normal uint8_t value

uint8_t scalar = 42;

or with the alias

aiscalar_u8_t scalar = 42;

Example: Print a U8 tensor to the console

print_aitensor(&example_tensor);
print_aitensor
void print_aitensor(const aitensor_t *tensor)
Printing a tensor to console.

Example: Print a U8 scalar to the console

print_aiscalar(&scalar, aiu8);
print_aiscalar
void print_aiscalar(const void *scalar, const aimath_dtype_t *dtype)
Printing a scalar to console.

## Function Documentation

## ◆ aimath_u8_print_aiscalar()

void aimath_u8_print_aiscalar | ( | const void * | scalar | ) |

Printing a U8 scalar to console.

For users the function

print_aiscalar(&scalar, aiu8);

is prefered.

Parameters

  *scalar | The scalar (type: uint8_t) to print.

## ◆ aimath_u8_print_aitensor()

void aimath_u8_print_aitensor | ( | const aitensor_t * | tensor | ) |

Printing a U8 tensor to console.

For users the function

print_aitensor(&tensor);

is prefered.

Parameters

  *tensor | The tensor to print.

## Variable Documentation

## ◆ aiu8

const aimath_dtype_t* aiu8
| extern

The U8 data-type indicator.

Use this variable to configure some element with the U8 data-type,