| AIfES 2 2.0.0

aimath_q31_default.h
Go to the documentation of this file.
1
25 #ifndef AIMATH_Q31_DEFAULT
26 #define AIMATH_Q31_DEFAULT
27
28 #define SHIFT_EQUALIZATION
29
30 #include <stdint.h>
31 #include <math.h>
32 #include <stdlib.h>
33
34 #include "basic/base/aimath/aimath_q31.h"
35
143 void aimath_q31_default_linear32(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result); //TODO Rename to aimath_q31_default_linear() (without 32) ?
144
181 void aimath_q31_default_mat_mul(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
182
217 void aimath_q31_default_multiply(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
218
249 void aimath_q31_default_scalar_mul(const void *scalar, const aitensor_t *a, aitensor_t *result);
250
289 void aimath_q31_default_tensor_add_different_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
290
328 void aimath_q31_default_tensor_add_same_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
329
368 void aimath_q31_default_tensor_sub_different_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
369
407 void aimath_q31_default_tensor_sub_same_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
408
438 void aimath_q31_default_copy_tensor(const aitensor_t *from, aitensor_t *to);
439
462 void aimath_q31_default_transpose_vector(aitensor_t *vector);
463
488 void aimath_q31_default_norm_squared(const aitensor_t *x, void *result);
489
517 void aimath_q31_default_tensor_sqrt(const aitensor_t *x, aitensor_t *result);
518
563 void aimath_q31_default_sigmoid(const aitensor_t *x, aitensor_t *result);
564
596 void aimath_q31_default_d_sigmoid(const aitensor_t *sigmoid_x, aitensor_t *result);
597
628 void aimath_q31_default_relu(const aitensor_t *x, aitensor_t *result);
629
663 void aimath_q31_default_d_relu(const aitensor_t *x, aitensor_t *result);
664
701 void aimath_q31_default_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result);
702
737 void aimath_q31_default_d_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result);
738
781 void aimath_q31_default_tanh(const aitensor_t *x, aitensor_t *result);
782
814 void aimath_q31_default_d_tanh(const aitensor_t *tanh_x, aitensor_t *result);
815
846 void aimath_q31_default_softsign(const aitensor_t *x, aitensor_t *result);
847
878 void aimath_q31_default_d_softsign(const aitensor_t *x, aitensor_t *result);
879
922 void aimath_q31_default_softmax(const aitensor_t *x, aitensor_t *result);
923
973 void aimath_q31_default_elu(const aitensor_t *x, const void *alpha, aitensor_t *result);
974
1008 void aimath_q31_default_d_elu(const aitensor_t *x, const void *alpha, aitensor_t *result);
1009
1033 void aimath_q31_default_zero_tensor(aitensor_t *tensor);
1034
1057 void aimath_q31_default_init_zeros(aitensor_t *tensor);
1058
1081 void aimath_q31_default_tensor_init_uniform(aitensor_t *tensor, float from, float to);
1082
1113 void aimath_q31_default_init_glorot_uniform(aitensor_t *tensor);
1114
1145 void aimath_q31_default_init_glorot_uniform_cdim(aitensor_t *tensor, int8_t cin_axis, int8_t cout_axis);
1146
1177 void aimath_q31_default_init_he_uniform(aitensor_t *tensor);
1178
1208 void aimath_q31_default_init_he_uniform_cdim(aitensor_t *tensor, int8_t cout_axis);
1209
1216 int64_t aimath_q31_default_sqrt(int64_t x);
1217
1229 void aimath_q31_default_sum_channelwise(const aitensor_t *x, int8_t channel_axis, aitensor_t *result);
1230
1231 // TODO: docs
1232 void aimath_q31_default_mse_gradients_sum(const aitensor_t *predicted, const aitensor_t *target, aitensor_t *result);
1233
1234 void aimath_q31_default_mse_gradients_mean(const aitensor_t *predicted, const aitensor_t *target, aitensor_t *result);
1235
1236 void aimath_q31_default_mse_loss_sum(const aitensor_t *predicted, const aitensor_t *target, void *result);
1237
1238 void aimath_q31_default_mse_loss_mean(const aitensor_t *predicted, const aitensor_t *target, void *result);
1239 #endif // AIMATH_Q31_DEFAULT
1240
aimath_q31.h
Definition of the Q31 (aiq31) data-type.
aimath_q31_default_tensor_sub_different_shift
void aimath_q31_default_tensor_sub_different_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs an element wise subtraction of Q31 tensors a and b with different shifts.
aimath_q31_default_scalar_mul
void aimath_q31_default_scalar_mul(const void *scalar, const aitensor_t *a, aitensor_t *result)
Performs a scalar multiplication (scaling) of Q31 tensor a and a scalar.
aimath_q31_default_linear32
void aimath_q31_default_linear32(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)
Performs a matrix multiplication of Q31 matrices a and b and adds a vector c to each row.
aimath_q31_default_sigmoid
void aimath_q31_default_sigmoid(const aitensor_t *x, aitensor_t *result)
Calculates the sigmoid of each element in a Q31 tensor.
aimath_q31_default_norm_squared
void aimath_q31_default_norm_squared(const aitensor_t *x, void *result)
Calculates the squared sum of all elements in a Q31 tensor.
aimath_q31_default_d_leaky_relu
void aimath_q31_default_d_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result)
Calculates the leaky rectifier (leaky-ReLU) derivative of each element in a Q31 tensor.
aimath_q31_default_mat_mul
void aimath_q31_default_mat_mul(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs a matrix multiplication of Q31 matrices a and b.
aimath_q31_default_init_glorot_uniform_cdim
void aimath_q31_default_init_glorot_uniform_cdim(aitensor_t *tensor, int8_t cin_axis, int8_t cout_axis)
Fills a Q31 tensor with random numbers uniformly within given range, according to Glorot et al.
aimath_q31_default_d_sigmoid
void aimath_q31_default_d_sigmoid(const aitensor_t *sigmoid_x, aitensor_t *result)
Calculates the derivative sigmoid of each element in a Q31 tensor.
aimath_q31_default_zero_tensor
void aimath_q31_default_zero_tensor(aitensor_t *tensor)
Fills a Q31 tensor with zeros.
aimath_q31_default_multiply
void aimath_q31_default_multiply(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs an element wise multiplication of Q31 tensors a and b (Hadamard product)
aimath_q31_default_init_zeros
void aimath_q31_default_init_zeros(aitensor_t *tensor)
Fills a Q31 tensor with zeros.
aimath_q31_default_tensor_add_same_shift
void aimath_q31_default_tensor_add_same_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs an element wise addition of Q31 tensors a and b with same shifts.
aimath_q31_default_leaky_relu
void aimath_q31_default_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result)
Calculates the leaky rectifier (leaky ReLU) value of each element in a Q31 tensor.
aimath_q31_default_sum_channelwise
void aimath_q31_default_sum_channelwise(const aitensor_t *x, int8_t channel_axis, aitensor_t *result)
Sums up all values of a channel of the Q31 tensor x.
aimath_q31_default_d_elu
void aimath_q31_default_d_elu(const aitensor_t *x, const void *alpha, aitensor_t *result)
Calculates the exponential rectifier (ELU) derivative of each element in a Q31 tensor.
aimath_q31_default_init_he_uniform
void aimath_q31_default_init_he_uniform(aitensor_t *tensor)
Fills a Q31 tensor with random numbers uniformly within given range, according to He et al.
aimath_q31_default_tensor_sub_same_shift
void aimath_q31_default_tensor_sub_same_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs an element wise subtraction of Q31 tensors a and b with same shifts.
aimath_q31_default_softmax
void aimath_q31_default_softmax(const aitensor_t *x, aitensor_t *result)
Calculates the softmax value of each batch element (row) of a Q31 tensor.
aimath_q31_default_transpose_vector
void aimath_q31_default_transpose_vector(aitensor_t *vector)
Transposes a Q31 vector.
aimath_q31_default_tensor_add_different_shift
void aimath_q31_default_tensor_add_different_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs an element wise addition of Q31 tensors a and b with different shifts.
aimath_q31_default_init_he_uniform_cdim
void aimath_q31_default_init_he_uniform_cdim(aitensor_t *tensor, int8_t cout_axis)
Fills a Q31 tensor with random numbers uniformly within given range, according to He et al.
aimath_q31_default_softsign
void aimath_q31_default_softsign(const aitensor_t *x, aitensor_t *result)
Calculates the softsign value of each element in a Q31 tensor.
aimath_q31_default_copy_tensor
void aimath_q31_default_copy_tensor(const aitensor_t *from, aitensor_t *to)
Performs an element wise copy of Q31 tensors.
aimath_q31_default_init_glorot_uniform
void aimath_q31_default_init_glorot_uniform(aitensor_t *tensor)
Fills a Q31 tensor with random numbers uniformly within given range, according to Glorot et al.
aimath_q31_default_sqrt
int64_t aimath_q31_default_sqrt(int64_t x)
Calculates square root of an int64 value.
aimath_q31_default_d_tanh
void aimath_q31_default_d_tanh(const aitensor_t *tanh_x, aitensor_t *result)
Calculates the tanh derivative of each element in a Q31 tensor.
aimath_q31_default_d_softsign
void aimath_q31_default_d_softsign(const aitensor_t *x, aitensor_t *result)
Calculates the softsign activation derivative of each element in a Q31 tensor.
aimath_q31_default_relu
void aimath_q31_default_relu(const aitensor_t *x, aitensor_t *result)
Calculates the rectifier (ReLU) value of each element in a Q31 tensor.
aimath_q31_default_elu
void aimath_q31_default_elu(const aitensor_t *x, const void *alpha, aitensor_t *result)
Calculates the exponential rectifier (ELU) value of each element in a Q31 tensor.
aimath_q31_default_d_relu
void aimath_q31_default_d_relu(const aitensor_t *x, aitensor_t *result)
Calculates the rectifier (ReLU) derivative of each element in a Q31 tensor.
aimath_q31_default_tanh
void aimath_q31_default_tanh(const aitensor_t *x, aitensor_t *result)
Calculates the tanh of each element in a Q31 tensor.
aimath_q31_default_tensor_init_uniform
void aimath_q31_default_tensor_init_uniform(aitensor_t *tensor, float from, float to)
Fills a Q31 tensor with random numbers created from a uniform distribution within given range.
aimath_q31_default_tensor_sqrt
void aimath_q31_default_tensor_sqrt(const aitensor_t *x, aitensor_t *result)
Calculates the element wise square root of a Q31 tensor.
aitensor
A tensor in AIfES.
Definition: aifes_math.h:89