The activation functions are used to filter out some input data. They include sigmoid, tanh and ReLU (Rectified Linear Unit) functions.
More...
|
| static void | hpm_nn_activate_s8 (q7_t *in_out, uint32_t size, uint16_t int_bits, riscv_nn_activation_fun act_fun) |
| | This function uses the sigmoid or tanh function to perform activation for signed 8-bit integer input vectors. More...
|
| |
| static void | hpm_nn_activate_s16 (q15_t *in_out, uint32_t size, uint16_t int_bits, riscv_nn_activation_fun act_fun) |
| | This function uses sigmoid or tanh function to perform activation for signed 16-bit integer input vectors. More...
|
| |
| static void | hpm_nn_leaky_relu_s8 (q7_t *in_out, uint32_t size, q15_t slope) riscv_nn_leaky_relu_s8(in_out |
| | This function uses the leaky ReLU function to perform activation for signed 8-bit integer input vectors. More...
|
| |
| static void | hpm_nn_relu_any_s8 (q7_t *data, uint16_t size, q7_t max_val) |
| | This function uses the ReLU function to perform activation for signed 8-bit integer input vectors. More...
|
| |
| static void | hpm_nn_relu_s8 (q7_t *in_out, uint32_t size) |
| | This function uses the ReLU function to perform activation for signed 8-bit integer input vectors. More...
|
| |
| static void | hpm_nn_relu_s16 (q15_t *in_out, uint32_t size) |
| | This function uses the ReLU function to perform activation for signed 16-bit integer input vectors. More...
|
| |
The activation functions are used to filter out some input data. They include sigmoid, tanh and ReLU (Rectified Linear Unit) functions.
◆ hpm_nn_activate_s16()
| static void hpm_nn_activate_s16 |
( |
q15_t * |
in_out, |
|
|
uint32_t |
size, |
|
|
uint16_t |
int_bits, |
|
|
riscv_nn_activation_fun |
act_fun |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function uses sigmoid or tanh function to perform activation for signed 16-bit integer input vectors.
- Parameters
-
| [in,out] | in_out | pointer of the input/output vector |
| [in] | size | number of elements in the input/output vector |
| [in] | int_bits | number of the bits in the integer part, which is supposed to be smaller than 4 |
| [in] | act_fun | selection of activation functions. See the Note below for details. |
- Note
- The availbale activation functions for selection include:
- NN_SIGMOID: Use the sigmoid activation function
- NN_TANH: Use the tanh activation function
◆ hpm_nn_activate_s8()
| static void hpm_nn_activate_s8 |
( |
q7_t * |
in_out, |
|
|
uint32_t |
size, |
|
|
uint16_t |
int_bits, |
|
|
riscv_nn_activation_fun |
act_fun |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function uses the sigmoid or tanh function to perform activation for signed 8-bit integer input vectors.
- Parameters
-
| [in,out] | in_out | pointer of the input/output vector |
| [in] | size | number of elements in the input/output vector |
| [in] | int_bits | number of the bits in the integer part, which is supposed to be smaller than 4 |
| [in] | act_fun | selection of activation functions. See the Note below for details. |
- Note
- The available activation functions for selection include:
- NN_SIGMOID: Use the sigmoid activation function
- NN_TANH: Use the tanh activation function
Example:
#define SIZE 32
q7_t in_out[SIZE] = {...};
static void hpm_nn_activate_s8(q7_t *in_out, uint32_t size, uint16_t int_bits, riscv_nn_activation_fun act_fun)
This function uses the sigmoid or tanh function to perform activation for signed 8-bit integer input ...
Definition: hpm_math.h:6876
◆ hpm_nn_leaky_relu_s8()
| static void hpm_nn_leaky_relu_s8 |
( |
q7_t * |
in_out, |
|
|
uint32_t |
size, |
|
|
q15_t |
slope |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function uses the leaky ReLU function to perform activation for signed 8-bit integer input vectors.
- Parameters
-
| [in,out] | in_out | pointer of the input/output vector |
| [in] | size | number of elements in the input/output vector |
| [in] | slope | slope value to be multiplied with the negative inputs. The result will be right shifted 15 bits to scale back to signed 8-bit integer. |
Example:
#define SIZE 1024
q7_t in_out[SIZE] = {...};
static void hpm_nn_leaky_relu_s8(q7_t *in_out, uint32_t size, q15_t slope) riscv_nn_leaky_relu_s8(in_out
This function uses the leaky ReLU function to perform activation for signed 8-bit integer input vecto...
static void slope
Definition: hpm_math.h:6938
◆ hpm_nn_relu_any_s8()
| static void hpm_nn_relu_any_s8 |
( |
q7_t * |
data, |
|
|
uint16_t |
size, |
|
|
q7_t |
max_val |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function uses the ReLU function to perform activation for signed 8-bit integer input vectors.
- Parameters
-
| [in,out] | data | pointer of the input/output vector |
| [in] | size | number of elements in the input/output vector |
| [in] | max_val | maximum value to limit the output vector |
◆ hpm_nn_relu_s16()
| static void hpm_nn_relu_s16 |
( |
q15_t * |
in_out, |
|
|
uint32_t |
size |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function uses the ReLU function to perform activation for signed 16-bit integer input vectors.
- Parameters
-
| [in,out] | in_out | pointer of the input/output vector |
| [in] | size | number of elements in the input/output vector |
◆ hpm_nn_relu_s8()
| static void hpm_nn_relu_s8 |
( |
q7_t * |
in_out, |
|
|
uint32_t |
size |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function uses the ReLU function to perform activation for signed 8-bit integer input vectors.
- Parameters
-
| [in,out] | in_out | pointer of the input/output vector |
| [in] | size | number of elements in the input/output vector |
Example:
#define H 16
#define W 16
#define CH 5
#define NUM (H * W *CH)
q7_t in_out[NUM] = {...};
static void hpm_nn_relu_s8(q7_t *in_out, uint32_t size)
This function uses the ReLU function to perform activation for signed 8-bit integer input vectors.
Definition: hpm_math.h:6974
◆ size
◆ slope