LIBML Version 4.1.9
LIBML NN Software Library
Loading...
Searching...
No Matches
Functions

The activation functions are used to filter out some input data. They include sigmoid, tanh and ReLU (Rectified Linear Unit) functions. More...

Functions

void tpt_nn_activation_q15 (q15_t *__restrict aOutData, const q15_t *__restrict aInData, uint16_t aCount, const uint16_t int_bits, const tpt_nn_activation_type type)
 q15_t neural network activation function using direct table look-up
void tpt_nn_activation_q7 (q7_t *__restrict aOutData, const q7_t *__restrict aInData, uint32_t aCount, const uint16_t int_bits, const tpt_nn_activation_type type)
 q7_t neural network activation function using direct table look-up
void tpt_relu_any_q7 (q7_t *aInData, const q7_t upper_bound, uint32_t aCount)
 Q7 RELU function.
void tpt_relu_any_q7_buf (q7_t *aOutData, const q7_t *aInData, const q7_t upper_bound, uint32_t aCount)
 Q7 RELU function.
void tpt_leaky_relu_q7 (q7_t *__restrict aOutData, const q7_t *__restrict aInData, q15_t slop, uint16_t aCount)
 Q7 LEAKY RELU function.
void tpt_relu_q7 (q7_t *aInData, uint16_t aCount)
 Q7 RELU function.
void tpt_relu_q15 (q15_t *aInData, uint16_t aCount)
 Q15 RELU function.
int32_t tpt_nn_tanh_f32 (f32_t *aOutData, const f32_t *aInData, uint32_t aCount)
 F32_t TANH function.

Variables

const q15_t tpt_sigmoid_table_q15 [256]
const q7_t tpt_sigmoid_table_q7 [256]
 tables for various activation functions
const q7_t tpt_tanh_table_q7 [256]
const q15_t tpt_tanh_table_q15 [256]

Detailed Description

The activation functions are used to filter out some input data. They include sigmoid, tanh and ReLU (Rectified Linear Unit) functions.

Function Documentation

◆ tpt_leaky_relu_q7()

void tpt_leaky_relu_q7 ( q7_t *__restrict aOutData,
const q7_t *__restrict aInData,
q15_t slop,
uint16_t aCount )

Q7 LEAKY RELU function.

Parameters
[out]aOutDatapointer to output
[in]aInDatapointer to input
[in]slopslope value to be multiplied with the negative inputs. The result will be right shifted 15 bits
[in]aCountnumber of elements
Returns
none

◆ tpt_nn_activation_q15()

void tpt_nn_activation_q15 ( q15_t *__restrict aOutData,
const q15_t *__restrict aInData,
uint16_t aCount,
const uint16_t int_bits,
const tpt_nn_activation_type type )

q15_t neural network activation function using direct table look-up

Parameters
[out]aOutDatapointer to output
[in]aInDarapointer to input data
[in]aCountnumber of elements
[in]int_bitsbit-width of the integer part, assume to be smaller than 4
[in]typetype of activation functions
Returns
none

Supported framework: TensorFlow Lite for Microcontrollers. This activation function must be bit precise congruent with the corresponding TFLM tanh and sigmoid actication functions

q15_t neural network activation function using direct table look-up

Note
Refer header file for details.

◆ tpt_nn_activation_q7()

void tpt_nn_activation_q7 ( q7_t *__restrict aOutData,
const q7_t *__restrict aInData,
uint32_t aCount,
const uint16_t int_bits,
const tpt_nn_activation_type type )

q7_t neural network activation function using direct table look-up

Parameters
[out]aOutDatapointer to output
[in]aInDarapointer to input data
[in]aCountnumber of elements
[in]int_bitsbit-width of the integer part, assume to be smaller than 4
[in]typetype of activation functions
Returns
none

Supported framework: TensorFlow Lite for Microcontrollers. This activation function must be bit precise congruent with the corresponding TFLM tanh and sigmoid actication functions

◆ tpt_nn_tanh_f32()

int32_t tpt_nn_tanh_f32 ( f32_t * aOutData,
const f32_t * aInData,
uint32_t aCount )

F32_t TANH function.

Parameters
[out]aOutDatapointer to output
[in]aInDatapointer to inpu
[in]aCountnumber of elements
Returns
0

◆ tpt_relu_any_q7()

void tpt_relu_any_q7 ( q7_t * aInData,
const q7_t upper_bound,
uint32_t aCount )

Q7 RELU function.

Parameters
[in]aInDatapointer to input/output
[in]upper_boundmaximum value to limit the output vector
[in]aCountnumber of elements
Returns
none

◆ tpt_relu_any_q7_buf()

void tpt_relu_any_q7_buf ( q7_t * aOutData,
const q7_t * aInData,
const q7_t upper_bound,
uint32_t aCount )

Q7 RELU function.

Parameters
[out]aOuDatapointer to output
[in]aInDatapointer to input
[in]upper_boundmaximum value to limit the output vector
[in]aCountnumber of elements
Returns
none

◆ tpt_relu_q15()

void tpt_relu_q15 ( q15_t * aInData,
uint16_t aCount )

Q15 RELU function.

Parameters
[in,out]aInDatapointer to input
[in]aCountnumber of elements
Returns
none

Q15 RELU function.

◆ tpt_relu_q7()

void tpt_relu_q7 ( q7_t * aInData,
uint16_t aCount )

Q7 RELU function.

Parameters
[in,out]aInDatapointer to input
[in]aCountnumber of elements
Returns
none

Q7 RELU function.

Variable Documentation

◆ tpt_sigmoid_table_q15

const q15_t tpt_sigmoid_table_q15[256]
extern

◆ tpt_sigmoid_table_q7

const q7_t tpt_sigmoid_table_q7[256]
extern

tables for various activation functions

This file include the declaration of common tables. Most of them are used for activation functions

◆ tpt_tanh_table_q15

const q15_t tpt_tanh_table_q15[256]
extern

◆ tpt_tanh_table_q7

const q7_t tpt_tanh_table_q7[256]
extern