| AIfES 2 2.0.0

aimath_f32_default.h
Go to the documentation of this file.
1
25 #ifndef AIMATH_F32_DEFAULT
26 #define AIMATH_F32_DEFAULT
27
28 #include <stdint.h>
29 #include <math.h>
30 #include <stdlib.h>
31
32 #include "basic/base/aimath/aimath_f32.h"
33
133 void aimath_f32_default_linear(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result);
134
184 void aimath_f32_default_linear_at(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result);
185
234 void aimath_f32_default_linear_bt(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result);
235
285 void aimath_f32_default_linear_atrt(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result);
286
319 void aimath_f32_default_mat_mul(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
320
356 void aimath_f32_default_mat_mul_at(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
357
391 void aimath_f32_default_mat_mul_bt(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
392
428 void aimath_f32_default_mat_mul_atrt(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
429
461 void aimath_f32_default_multiply(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
462
494 void aimath_f32_default_divide(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
495
524 void aimath_f32_default_scalar_mul(const void *scalar, const aitensor_t *a, aitensor_t *result);
525
557 void aimath_f32_default_scalar_add(const void *scalar, const aitensor_t *a, aitensor_t *result);
558
590 void aimath_f32_default_tensor_add(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
591
592
624 void aimath_f32_default_tensor_sub(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
625
673 void aimath_f32_default_tensor_sub_sparse8(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
674
702 void aimath_f32_default_copy_tensor(const aitensor_t *from, aitensor_t *to);
703
725 void aimath_f32_default_transpose_vector(aitensor_t *vector);
726
747 void aimath_f32_default_transpose_matrix(aitensor_t *x);
748
772 void aimath_f32_default_norm_squared(const aitensor_t *x, void *result);
773
797 void aimath_f32_default_sum(const aitensor_t *x, void *result);
798
822 void aimath_f32_default_min(const aitensor_t *x, void *result);
823
849 void aimath_f32_default_max(const aitensor_t *x, void *result);
850
876 void aimath_f32_default_sigmoid(const aitensor_t *x, aitensor_t *result);
877
904 void aimath_f32_default_d_sigmoid(const aitensor_t *sigmoid_x, aitensor_t *result);
905
931 void aimath_f32_default_tanh(const aitensor_t *x, aitensor_t *result);
932
959 void aimath_f32_default_d_tanh(const aitensor_t *tanh_x, aitensor_t *result);
960
986 void aimath_f32_default_relu(const aitensor_t *x, aitensor_t *result);
987
988
1017 void aimath_f32_default_d_relu(const aitensor_t *x, aitensor_t *result);
1018
1050 void aimath_f32_default_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result);
1051
1083 void aimath_f32_default_d_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result);
1084
1116 void aimath_f32_default_elu(const aitensor_t *x, const void *alpha, aitensor_t *result);
1117
1149 void aimath_f32_default_d_elu(const aitensor_t *x, const void *alpha, aitensor_t *result);
1150
1176 void aimath_f32_default_softmax(const aitensor_t *x, aitensor_t *result);
1177
1203 void aimath_f32_default_softsign(const aitensor_t *x, aitensor_t *result);
1204
1230 void aimath_f32_default_d_softsign(const aitensor_t *x, aitensor_t *result);
1231
1261 void aimath_f32_default_binary_crossentropy_sum(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result);
1262
1292 void aimath_f32_default_binary_crossentropy_mean(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result);
1293
1323 void aimath_f32_default_categorical_crossentropy_sum(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result);
1324
1354 void aimath_f32_default_categorical_crossentropy_mean(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result);
1355
1398 void aimath_f32_default_categorical_crossentropy_sum_sparse8(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result);
1399
1442 void aimath_f32_default_categorical_crossentropy_mean_sparse8(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result);
1443
1469 void aimath_f32_default_sqrt(const aitensor_t *x, aitensor_t *result);
1470
1493 void aimath_f32_default_zero_tensor(aitensor_t *tensor);
1494
1517 void aimath_f32_default_init_zeros(aitensor_t *tensor);
1518
1538 void aimath_f32_default_init_ones(aitensor_t *tensor);
1539
1561 void aimath_f32_default_tensor_init_uniform(aitensor_t *tensor, float from, float to);
1562
1592 void aimath_f32_default_init_glorot_uniform(aitensor_t *tensor);
1593
1623 void aimath_f32_default_init_glorot_uniform_cdim(aitensor_t *tensor, int8_t cin_axis, int8_t cout_axis);
1624
1654 void aimath_f32_default_init_he_uniform(aitensor_t *tensor);
1655
1684 void aimath_f32_default_init_he_uniform_cdim(aitensor_t *tensor, int8_t cout_axis);
1685
1692 float aimath_f32_default_expf_fast(const float x);
1693
1705 void aimath_f32_default_sum_channelwise(const aitensor_t *x, int8_t channel_axis, aitensor_t *result);
1706
1718 void aimath_f32_default_mean_channelwise(const aitensor_t *x, int8_t channel_axis, aitensor_t *result);
1719
1732 void aimath_f32_default_variance_channelwise(const aitensor_t *x, int8_t channel_axis, const aitensor_t *means, aitensor_t *result);
1733
1745 void aimath_f32_default_exponential_moving_average(const aitensor_t *new_data, const void *momentum, aitensor_t *average);
1746
1753 void aimath_f32_default_mse_gradients_sum(const aitensor_t *predicted, const aitensor_t *target, aitensor_t *result);
1754
1761 void aimath_f32_default_mse_gradients_mean(const aitensor_t *predicted, const aitensor_t *target, aitensor_t *result);
1762
1769 void aimath_f32_default_mse_loss_sum(const aitensor_t *predicted, const aitensor_t *target, void *result);
1770
1777 void aimath_f32_default_mse_loss_mean(const aitensor_t *predicted, const aitensor_t *target, void *result);
1778
1784 void aimath_f32_default_scale_by_batch_size(const aitensor_t *a, aitensor_t *result);
1785 #endif // AIMATH_F32_DEFAULT
1786
aimath_f32.h
Definition of the F32 (aif32) data-type.
aimath_f32_default_binary_crossentropy_sum
void aimath_f32_default_binary_crossentropy_sum(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result)
Calculates the binary cross entropy between the F32 predicted and the target data using a sum reduct...
aimath_f32_default_mat_mul_bt
void aimath_f32_default_mat_mul_bt(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs a matrix multiplication of F32 matrices a and b (transposed)
aimath_f32_default_zero_tensor
void aimath_f32_default_zero_tensor(aitensor_t *tensor)
Fills a F32 tensor with zeros.
aimath_f32_default_mean_channelwise
void aimath_f32_default_mean_channelwise(const aitensor_t *x, int8_t channel_axis, aitensor_t *result)
Sums up all values of a channel of the F32 tensor x.
aimath_f32_default_d_softsign
void aimath_f32_default_d_softsign(const aitensor_t *x, aitensor_t *result)
Calculates the softsign derivative of each element in a F32 tensor.
aimath_f32_default_init_he_uniform
void aimath_f32_default_init_he_uniform(aitensor_t *tensor)
Fills a F32 tensor with uniformly drawn random numbers within given range, according to He et al.
aimath_f32_default_sum
void aimath_f32_default_sum(const aitensor_t *x, void *result)
Calculates the sum of all elements in a F32 tensor.
aimath_f32_default_linear
void aimath_f32_default_linear(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)
Performs a matrix multiplication of F32 matrices a and b and adds a vector c to each row.
aimath_f32_default_init_ones
void aimath_f32_default_init_ones(aitensor_t *tensor)
Fills a F32 tensor with ones.
aimath_f32_default_norm_squared
void aimath_f32_default_norm_squared(const aitensor_t *x, void *result)
Calculates the squared sum of all elements in a F32 tensor.
aimath_f32_default_linear_bt
void aimath_f32_default_linear_bt(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)
Performs a matrix multiplication of F32 matrices a and b (transposed) and adds a vector c to each ro...
aimath_f32_default_tensor_add
void aimath_f32_default_tensor_add(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs an element wise addition of F32 tensors a and b.
aimath_f32_default_min
void aimath_f32_default_min(const aitensor_t *x, void *result)
Identifies the minimum value in a F32 tensor.
aimath_f32_default_d_elu
void aimath_f32_default_d_elu(const aitensor_t *x, const void *alpha, aitensor_t *result)
Calculates the exponential rectifier (ELU) derivative of each element in a F32 tensor.
aimath_f32_default_max
void aimath_f32_default_max(const aitensor_t *x, void *result)
Identifies the maximum value in a F32 tensor.
aimath_f32_default_d_sigmoid
void aimath_f32_default_d_sigmoid(const aitensor_t *sigmoid_x, aitensor_t *result)
Calculates the derivative sigmoid of each element in a F32 tensor.
aimath_f32_default_mat_mul_atrt
void aimath_f32_default_mat_mul_atrt(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs a matrix multiplication with transposed result of F32 matrices a (transposed) and b.
aimath_f32_default_sqrt
void aimath_f32_default_sqrt(const aitensor_t *x, aitensor_t *result)
Calculates the element wise square root of a F32 tensor.
aimath_f32_default_mse_gradients_sum
void aimath_f32_default_mse_gradients_sum(const aitensor_t *predicted, const aitensor_t *target, aitensor_t *result)
Calculates the gradients of the mean squared error between the F32 predicted and the target data usi...
aimath_f32_default_transpose_matrix
void aimath_f32_default_transpose_matrix(aitensor_t *x)
Transpose a F32 tensor.
aimath_f32_default_categorical_crossentropy_mean
void aimath_f32_default_categorical_crossentropy_mean(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result)
Calculates the categorical cross entropy between the F32 predicted and the target data using a mean ...
aimath_f32_default_d_tanh
void aimath_f32_default_d_tanh(const aitensor_t *tanh_x, aitensor_t *result)
Calculates the tanh derivative of each element in a F32 tensor.
aimath_f32_default_divide
void aimath_f32_default_divide(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs an element wise division of F32 tensors a and b (Hadamard division)
aimath_f32_default_tensor_init_uniform
void aimath_f32_default_tensor_init_uniform(aitensor_t *tensor, float from, float to)
Fills a F32 tensor with random numbers created from a uniform distribution within given range.
aimath_f32_default_scalar_mul
void aimath_f32_default_scalar_mul(const void *scalar, const aitensor_t *a, aitensor_t *result)
Performs a scalar multiplication (scaling) of F32 tensor a and a scalar.
aimath_f32_default_relu
void aimath_f32_default_relu(const aitensor_t *x, aitensor_t *result)
Calculates the rectifier (ReLU) value of each element in a F32 tensor.
aimath_f32_default_softsign
void aimath_f32_default_softsign(const aitensor_t *x, aitensor_t *result)
Calculates the softsign value of each element in a F32 tensor.
aimath_f32_default_linear_at
void aimath_f32_default_linear_at(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)
Performs a matrix multiplication of F32 matrices a (transposed) and b and adds a vector c to each ro...
aimath_f32_default_transpose_vector
void aimath_f32_default_transpose_vector(aitensor_t *vector)
Transposes a F32 vector.
aimath_f32_default_init_zeros
void aimath_f32_default_init_zeros(aitensor_t *tensor)
Fills a F32 tensor with zeros.
aimath_f32_default_elu
void aimath_f32_default_elu(const aitensor_t *x, const void *alpha, aitensor_t *result)
Calculates the exponential rectifier (ELU) value of each element in a F32 tensor.
aimath_f32_default_mat_mul
void aimath_f32_default_mat_mul(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs a matrix multiplication of F32 matrices a and b.
aimath_f32_default_mse_gradients_mean
void aimath_f32_default_mse_gradients_mean(const aitensor_t *predicted, const aitensor_t *target, aitensor_t *result)
Calculates the gradients of the mean squared error between the F32 predicted and the target data usi...
aimath_f32_default_scale_by_batch_size
void aimath_f32_default_scale_by_batch_size(const aitensor_t *a, aitensor_t *result)
Scales a F32 tensor by batch size (size of first dimension)
aimath_f32_default_mse_loss_sum
void aimath_f32_default_mse_loss_sum(const aitensor_t *predicted, const aitensor_t *target, void *result)
Calculates the mean squared error between the F32 predicted and the target data using a sum reductio...
aimath_f32_default_categorical_crossentropy_mean_sparse8
void aimath_f32_default_categorical_crossentropy_mean_sparse8(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result)
Calculates the categorical Cross-Entropy between the F32 predicted data and the U8 target data in s...
aimath_f32_default_mse_loss_mean
void aimath_f32_default_mse_loss_mean(const aitensor_t *predicted, const aitensor_t *target, void *result)
Calculates the mean squared error between the F32 predicted and the target data using a mean reducti...
aimath_f32_default_d_leaky_relu
void aimath_f32_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 F32 tensor.
aimath_f32_default_expf_fast
float aimath_f32_default_expf_fast(const float x)
Fast approximation of the exponential function.
aimath_f32_default_init_glorot_uniform_cdim
void aimath_f32_default_init_glorot_uniform_cdim(aitensor_t *tensor, int8_t cin_axis, int8_t cout_axis)
Fills a F32 tensor with random numbers uniformly within given range, according to Glorot et al.
aimath_f32_default_sigmoid
void aimath_f32_default_sigmoid(const aitensor_t *x, aitensor_t *result)
Calculates the sigmoid of each element in a F32 tensor.
aimath_f32_default_copy_tensor
void aimath_f32_default_copy_tensor(const aitensor_t *from, aitensor_t *to)
Performs an element wise copy of F32 tensors.
aimath_f32_default_categorical_crossentropy_sum_sparse8
void aimath_f32_default_categorical_crossentropy_sum_sparse8(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result)
Calculates the categorical Cross-Entropy between the F32 predicted data and the U8 target data in s...
aimath_f32_default_init_glorot_uniform
void aimath_f32_default_init_glorot_uniform(aitensor_t *tensor)
Fills a F32 tensor with random numbers uniformly within given range, according to Glorot et al.
aimath_f32_default_d_relu
void aimath_f32_default_d_relu(const aitensor_t *x, aitensor_t *result)
Calculates the rectifier (ReLU) derivative of each element in a F32 tensor.
aimath_f32_default_categorical_crossentropy_sum
void aimath_f32_default_categorical_crossentropy_sum(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result)
Calculates the categorical cross entropy between the F32 predicted and the target data using a sum r...
aimath_f32_default_tanh
void aimath_f32_default_tanh(const aitensor_t *x, aitensor_t *result)
Calculates the tanh of each element in a F32 tensor.
aimath_f32_default_scalar_add
void aimath_f32_default_scalar_add(const void *scalar, const aitensor_t *a, aitensor_t *result)
Performs an element wise addition of a scalar to a F32 tensor.
aimath_f32_default_multiply
void aimath_f32_default_multiply(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs an element wise multiplication of F32 tensors a and b (Hadamard product)
aimath_f32_default_softmax
void aimath_f32_default_softmax(const aitensor_t *x, aitensor_t *result)
Calculates the softmax value of each row of a F32 matrix.
aimath_f32_default_tensor_sub_sparse8
void aimath_f32_default_tensor_sub_sparse8(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs a subtraction between a F32 matrix a and a U8 sparse matrix b.
aimath_f32_default_linear_atrt
void aimath_f32_default_linear_atrt(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)
Performs a matrix multiplication with transposed result of F32 matrices a (transposed) and b and add...
aimath_f32_default_mat_mul_at
void aimath_f32_default_mat_mul_at(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs a matrix multiplication of F32 matrices a (transposed) and b.
aimath_f32_default_binary_crossentropy_mean
void aimath_f32_default_binary_crossentropy_mean(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result)
Calculates the binary cross entropy between the F32 predicted and the target data using a mean reduc...
aimath_f32_default_tensor_sub
void aimath_f32_default_tensor_sub(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Performs a element wise subtraction of F32 tensors a and b.
aimath_f32_default_exponential_moving_average
void aimath_f32_default_exponential_moving_average(const aitensor_t *new_data, const void *momentum, aitensor_t *average)
Perform an exponential moving average.
aimath_f32_default_leaky_relu
void aimath_f32_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 F32 tensor.
aimath_f32_default_variance_channelwise
void aimath_f32_default_variance_channelwise(const aitensor_t *x, int8_t channel_axis, const aitensor_t *means, aitensor_t *result)
Calculate the channel-wise variances of the F32 tensor x.
aimath_f32_default_init_he_uniform_cdim
void aimath_f32_default_init_he_uniform_cdim(aitensor_t *tensor, int8_t cout_axis)
Fills a F32 tensor with uniformly drawn random numbers within given range, according to He et al.
aitensor
A tensor in AIfES.
Definition: aifes_math.h:89