The basic functions are used to perform element-wise basic arithmetic operations. More...
Functions | |
| static void | hpm_nn_add_s8_sym (const q7_t *in_tensor1, const q7_t *in_tensor2, const int16_t *scale1, const int16_t *scale2, const uint32_t size, const uint16_t pre_rshift, const uint16_t out_scale, const uint16_t post_rshift, q7_t *out) |
| This function performs element-wise addition for signed 8-bit integer input vectors with two-stage shift. More... | |
| static void | hpm_nn_add_s8_sym_round (const q7_t *in_tensor1, const q7_t *in_tensor2, const uint32_t scale1, const uint32_t scale2, const uint32_t size, const uint16_t pre_rshift, const uint16_t out_scale, const uint16_t post_rshift, q7_t *out) |
| This function performs element-wise addition for signed 8-bit integer input vectors with two-stage shift with rounding. More... | |
| static int | hpm_nn_ew_add_s8_asym (const int8_t *in_tensor1, const int8_t *in_tensor2, const int32_t in_offset1, const int32_t in_scale1, const int32_t in_rshift1, const int32_t in_offset2, const int32_t in_scale2, const int32_t in_rshift2, const int32_t lshift, int8_t *out, const int32_t out_offset, const int32_t out_scale, const int32_t out_rshift, const int32_t act_min, const int32_t act_max, const uint32_t size) |
| This function performs element-wise addition for signed 8-bit integer input vectors. More... | |
| static int | hpm_nn_ew_mul_s8_asym (const int8_t *in_tensor1, const int8_t *in_tensor2, const int32_t in_offset1, const int32_t in_offset2, int8_t *out, const int32_t out_offset, const int32_t out_scale, const int32_t out_shift, const int32_t act_min, const int32_t act_max, const uint32_t size) |
| This function performs element-wise multiplication for signed 8-bit integer input vectors. More... | |
The basic functions are used to perform element-wise basic arithmetic operations.
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function performs element-wise addition for signed 8-bit integer input vectors with two-stage shift.
| [in] | in_tensor1 | pointer of the first input vector |
| [in] | in_tensor2 | pointer of the second input vector |
| [in] | scale1 | pointer of the first scaling vector |
| [in] | scale2 | pointer of the second scaling vector |
| [in] | size | number of elements in the input vectors |
| [in] | pre_rshift | right shift amount for the accumulator before the scaling |
| [in] | out_scale | scaling value for the accumulator |
| [in] | post_rshift | right shift amount for the accumulator after the scaling |
| [out] | out | pointer of the element-wise addition results |
Example:
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function performs element-wise addition for signed 8-bit integer input vectors with two-stage shift with rounding.
| [in] | in_tensor1 | pointer of the first input vector |
| [in] | in_tensor2 | pointer of the second input vector |
| [in] | scale1 | scaling value for the first input vector. It should be in the range of 0 to {2^23}. |
| [in] | scale2 | scaling value for the second input vector. It should be in the range of 0 to {2^23}. |
| [in] | size | number of elements in the input vectors |
| [in] | pre_rshift | right shift amount for the accumulator before the scaling |
| [in] | out_scale | scaling value for the accumulator |
| [in] | post_rshift | right shift amount for the accumulator after the scaling |
| [out] | out | pointer of element-wise addition results |
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function performs element-wise addition for signed 8-bit integer input vectors.
| [in] | in_tensor1 | pointer of the first input vector |
| [in] | in_tensor2 | pointer of the second input vector |
| [in] | in_offset1 | offset value for first input vector. It should be in the range of -127 to 128. |
| [in] | in_scale1 | scaling value for first input vector |
| [in] | in_rshift1 | right shift amount for the first input vector |
| [in] | in_offset2 | offset value for the second input vector. It should be in the range of -127 to 128. |
| [in] | in_scale2 | scaling value for the second input vector |
| [in] | in_rshift2 | right shift amount for the second input vector |
| [in] | lshift | left shift amount for the first and second input vectors |
| [out] | out | pointer of the element-wise addition results |
| [in] | out_offset | offset value for the output |
| [in] | out_scale | scaling value for the output |
| [in] | out_rshift | right shift amount for the output |
| [in] | act_min | minimum value that the output is limited to |
| [in] | act_max | maximum value that the output is limited to |
| [in] | size | number of elements in the input vectors |
Example:
|
inlinestatic |
#include <middleware/hpm_math/hpm_math.h>
This function performs element-wise multiplication for signed 8-bit integer input vectors.
| [in] | in_tensor1 | pointer of the first input vector |
| [in] | in_tensor2 | pointer of the second input vector |
| [in] | in_offset1 | offset value for the first input vector. It should be in the range of -127 to 128. |
| [in] | in_offset2 | offset value for the second input vector. It should be in the range of -127 to 128. |
| [out] | out | pointer of element-wise multiplication results |
| [in] | out_offset | offset value for the output |
| [in] | out_scale | scaling value for the output |
| [in] | out_shift | shift amount for the output |
| [in] | act_min | minimum value that the output is limited to |
| [in] | act_max | maximum value that the output is limited to |
| [in] | size | number of elements in the input vectors |
Example: