|
| | NN Activation Functions |
| | The activation functions are used to filter out some input data. They include sigmoid, tanh and ReLU (Rectified Linear Unit) functions.
|
| |
| | NN Basic Functions |
| | The basic functions are used to perform element-wise basic arithmetic operations.
|
| |
| | NN Concatenation Functions |
| | The concatenation functions are used to concatenate the tensor along the specified axis.
|
| |
| | NN Convolution Functions |
| | The convolution functions transform the input matrix into a column vector with im2col, and then use matrix-matrix multiplication to get the convolution result.
|
| |
| | NN Fully Connected Functions |
| | The fully connected functions multiply the input vector by a weight matrix and add a bias, if any, to the result. The supported combinations of input vector and weight matrix are (signed 8-bit integer, signed 8-bit integer), (unsigned 8-bit integer, signed 8-bit integer), (signed 16-bit integer, signed 8-bit integer), (signed 16-bit integer, signed 16-bit integer) and (16-bit half-precision floating point, 16-bit half-precision floating point).
|
| |
| | NN Pooling Functions |
| | The pooling functions are used to downsample input data. They include max and average pooling functions.
|
| |
| | NN Softmax Functions |
| | The softmax functions are exponential functions with base 2.
|
| |
| | NN Utils Functions |
| | Utils functions are miscellaneous auxiliary tools.
|
| |
|
| static void | hpm_dsp_sort_init_f32 (riscv_dsp_sort_f32_t *instance, riscv_dsp_sort_alg alg, riscv_dsp_sort_order order) |
| |
| static void | hpm_dsp_sort_f32 (const riscv_dsp_sort_f32_t *instance, float32_t *src, float32_t *dst, uint32_t size) |
| | Generic sorting function. More...
|
| |
| static void | hpm_dsp_sort_merge_init_f32 (riscv_dsp_sort_merge_f32_t *instance, riscv_dsp_sort_order order, float32_t *buf) |
| |
| static void | hpm_dsp_sort_merge_f32 (const riscv_dsp_sort_merge_f32_t *instance, float32_t *src, float32_t *dst, uint32_t size) |
| | Merge sort. More...
|
| |
| static void | write_q15x2_ia (q15_t **pQ15, q31_t value) |
| |
| __STATIC_FORCEINLINE q31_t | hpm_nn_read_q15x2_ia (const q15_t **in_q15) |
| | Read 2 q15 elements and post increment pointer. More...
|
| |
| __STATIC_FORCEINLINE q31_t | hpm_nn_sat_doubling_high_mult (const q31_t m1, const q31_t m2) |
| | Saturating doubling high multiply. Result matches NEON instruction VQRDMULH. More...
|
| |
| __STATIC_FORCEINLINE q31_t | hpm_nn_divide_by_power_of_two (const q31_t dividend, const q31_t exponent) |
| | Rounding divide by power of two. More...
|
| |
| __STATIC_FORCEINLINE q31_t | hpm_nn_requantize (const q31_t val, const q31_t multiplier, const q31_t shift) |
| |
| __STATIC_FORCEINLINE q31_t | hpm_nn_read_q7x4_ia (const q7_t **in_q7) |
| | Read 4 q7 from q7 pointer and post increment pointer. More...
|
| |
| __STATIC_FORCEINLINE const q7_t * | read_and_pad_reordered (const q7_t *source, q31_t *out1, q31_t *out2) |
| | read and expand one q7 word into two q15 words with reordering More...
|
| |
| __STATIC_FORCEINLINE const q7_t * | read_and_pad (const q7_t *source, q31_t *out1, q31_t *out2) |
| | read and expand one q7 word into two q15 words More...
|
| |
| __STATIC_FORCEINLINE int32_t | hpm_nn_read_s8x4_ia (const int8_t **in_s8) |
| | Read 4 s8 from s8 pointer and post increment pointer. More...
|
| |
| __STATIC_FORCEINLINE void | hpm_nn_q7_to_q15_with_offset (const int8_t *src, int16_t *dst, int32_t block_size, int16_t offset) |
| |
The generic sort function sorts elements of a vector by the algorithm and sorting order specified in its instance structure. The algorithms to be chosen from to perform the generic sorting include bitonic sort, bubble sort, heap sort, insertion sort, quick sort and selection sort. Andes DSP library only supports the generic sort function for floating-point data.
| static void hpm_dsp_sort_f32 |
( |
const riscv_dsp_sort_f32_t * |
instance, |
|
|
float32_t * |
src, |
|
|
float32_t * |
dst, |
|
|
uint32_t |
size |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
Generic sorting function.
- Parameters
-
| [in] | instance | pointer of the instance structure |
| [in] | src | pointer of the input vector |
| [out] | dst | pointer of the output vector |
| [in] | size | number of elements in a vector |
Note:
- The possible sorting algorithms for the generic sorting (i.e., options for alg) include
- RISCV_DSP_SORT_BITONIC bitonic sort
- RISCV_DSP_SORT_BUBBLE bubble sort
- RISCV_DSP_SORT_HEAP heap sort
- RISCV_DSP_SORT_INSERTION insertion sort
- RISCV_DSP_SORT_QUICK quick sort
- RISCV_DSP_SORT_SELECTION selection sort
- The possible sorting orders for the generic sorting (i.e., options for order) include
- RISCV_DSP_SORT_DESCENDING descending order
- RISCV_DSP_SORT_ASCENDING ascending order
- To ensure correct results, you must initialize the instance structure with the function riscv_dsp_sort_init_f32 before using this function riscv_dsp_sort_f32. For how to use the two functions, please refer to the code examples below.
Example
With the input size as 100, sorting order as ascending and sorting algorithm as quick
sort, the code example of generic sorting is as follows:
#define size 100
riscv_dsp_sort_f32_t *instance;
float32_t src[size] = {};
float32_t dst[size];
riscv_dsp_sort_init_f32(instance, RISCV_DSP_SORT_QUICK,
RISCV_DSP_SORT_ASCENDING);
riscv_dsp_sort_f32(instance, src, dst, size);
| static void hpm_dsp_sort_merge_f32 |
( |
const riscv_dsp_sort_merge_f32_t * |
instance, |
|
|
float32_t * |
src, |
|
|
float32_t * |
dst, |
|
|
uint32_t |
size |
|
) |
| |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
Merge sort.
- Parameters
-
| [in] | instance | pointer of the instance structure. |
| [in] | src | pointer of the input vector |
| [out] | dst | pointer of the output vector |
| [in] | size | number of elements in a vector |
Note:
- The possible sorting orders for the merge sorting (i.e., options for order) include
- RISCV_DSP_SORT_DESCENDING descending order
- RISCV_DSP_SORT_ASCENDING ascending order
- To ensure correct results, you must initialize the instance structure with the function riscv_dsp_sort_merge_init_f32 before using this function riscv_dsp_sort_merge_f32. For how to use the two functions, please refer to the code example below.
Example
With the input size as 100 and sorting order as descending, the code example of merge
sorting is as follows:
#define size 100
riscv_dsp_sort_merge_f32_t *instance;
float32_t src[size] = {};
float32_t buf[size];
float32_t dst[size];
riscv_dsp_sort_merge_init_f32(instance, RISCV_DSP_SORT_DESCENDING, buf);
riscv_dsp_sort_merge_f32(instance, src, dst, size);