AIfES 2  2.0.0
aimath_cnn_f32_default.h
Go to the documentation of this file.
1 
25 #ifndef AIMATH_CNN_F32_DEFAULT_H
26 #define AIMATH_CNN_F32_DEFAULT_H
27 
28 #include <stdint.h>
29 #include <math.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32 
33 #include "core/aifes_core.h"
36 
37 
38 #define AIFES_PADDING_SAME 0xFFFF // Not fully implemented yet
39 #define AIFES_PADDING_VALID 0
40 
41 
72  const uint16_t stride[2], // [s_h, s_w]
73  const uint16_t dilation[2], // [d_h, d_w]
74  const int16_t padding[2][2],
75  const aitensor_t *kernel,
76  const void *bias,
77  const uint8_t rotated_kernel, // wether or not the kernel is rotated by 180°; default is TRUE (1)
78  const int16_t *input_use_dims, // Indices of dimensions for h and w
79  const int16_t *output_use_dims, // Indices of dimensions for h and w
80  const int16_t *kernel_use_dims, // Indices of dimensions for h and w
81  aitensor_t *output);
82 
113  const uint16_t stride[2], // [s_h, s_w]; dilation of input
114  const uint16_t dilation[2], // [d_h, d_w]; dilation of kernel
115  const int16_t padding[2][2],
116  const aitensor_t *kernel,
117  const void *bias,
118  const uint8_t rotated_kernel, // wether or not the kernel is rotated by 180°; default is TRUE (1)
119  const int16_t *input_use_dims, // Indices of dimensions for h and w
120  const int16_t *output_use_dims, // Indices of dimensions for h and w
121  const int16_t *kernel_use_dims, // Indices of dimensions for h and w
122  aitensor_t *output);
123 
124 
125 
145  const aitensor_t *input,
146  const uint16_t stride[2], // [s_h, s_w]
147  const uint16_t dilation[2], // [d_h, d_w]
148  const uint16_t padding[2],
149  const aitensor_t *weights,
150  const aitensor_t *bias,
151  int8_t channel_axis,
152  void *work_space,
153  aitensor_t *output
154  );
155 
176  const aitensor_t *x_in,
177  const uint16_t stride[2], // [s_h, s_w]
178  const uint16_t dilation[2], // [d_h, d_w]
179  const uint16_t padding[2],
180  const aitensor_t *delta_out,
181  int8_t channel_axis,
182  void *work_space,
183  aitensor_t *d_weights
184 );
185 
207  const aitensor_t *delta_out,
208  const uint16_t stride[2], // [s_h, s_w]
209  const uint16_t dilation[2], // [d_h, d_w]
210  const uint16_t padding[2],
211  const aitensor_t *weights,
212  int8_t channel_axis,
213  void *work_space,
214  aitensor_t *delta_in
215 );
216 
238  const aitensor_t *input,
239  const uint16_t stride[2], // input dilation
240  const uint16_t dilation[2], // kernel dilation
241  const uint16_t padding[2],
242  const uint16_t output_padding[2],
243  const aitensor_t *weights,
244  const aitensor_t *bias,
245  int8_t channel_axis,
246  void *work_space,
247  aitensor_t *output
248  );
249 
276  const aitensor_t *input,
277  const uint16_t pool_size[2],
278  const uint16_t stride[2],
279  const uint16_t padding[2],
280  int8_t channel_axis,
281  void *work_space,
282  uint32_t *max_locations,
283  aitensor_t *output
284  );
285 
303  const aitensor_t *delta_out,
304  const uint16_t pool_size[2],
305  const uint16_t stride[2],
306  const uint16_t padding[2],
307  int8_t channel_axis,
308  void *work_space,
309  const uint32_t *max_locations,
310  aitensor_t *delta_in
311  );
312 
330  int8_t axis,
331  const aitensor_t *means,
332  const aitensor_t *variances,
333  const aitensor_t *offsets,
334  const aitensor_t *scales,
335  const void *eps,
336  aitensor_t *result);
337 
358  int8_t axis,
359  const aitensor_t *means,
360  const aitensor_t *vars,
361  const aitensor_t *betas,
362  const aitensor_t *gammas,
363  const aitensor_t *delta_out,
364  const void *eps,
365  aitensor_t *delta_in,
366  aitensor_t *d_betas,
367  aitensor_t *d_gammas);
368 
375 void aimath_f32_default_pad_zeros(const aitensor_t *x, const uint16_t (*padding)[2], aitensor_t *result);
376 
377  #endif // AIMATH_CNN_F32_DEFAULT_H
AIfES 2 core interface.
void aimath_f32_default_maxpool2d_fwd(const aitensor_t *input, const uint16_t pool_size[2], const uint16_t stride[2], const uint16_t padding[2], int8_t channel_axis, void *work_space, uint32_t *max_locations, aitensor_t *output)
2D max-pooling on 4D F32 tensors
void aimath_f32_default_pad_zeros(const aitensor_t *x, const uint16_t(*padding)[2], aitensor_t *result)
Pads a F32 tensor with zeros.
void aimath_f32_default_d_batch_norm(const aitensor_t *x_in, int8_t axis, const aitensor_t *means, const aitensor_t *vars, const aitensor_t *betas, const aitensor_t *gammas, const aitensor_t *delta_out, const void *eps, aitensor_t *delta_in, aitensor_t *d_betas, aitensor_t *d_gammas)
Calculates the gradients of Batch Normalization with respect to betas, gammas and the input in F32 d...
void aimath_f32_default_conv_transpose2d_add(const aitensor_t *input, const uint16_t stride[2], const uint16_t dilation[2], const int16_t padding[2][2], const aitensor_t *kernel, const void *bias, const uint8_t rotated_kernel, const int16_t *input_use_dims, const int16_t *output_use_dims, const int16_t *kernel_use_dims, aitensor_t *output)
Performs 2D transposed convolution (or deconvolution) on slices of 4D F32 tensors and adds an option...
void aimath_f32_default_conv2d_bwd_full(const aitensor_t *delta_out, const uint16_t stride[2], const uint16_t dilation[2], const uint16_t padding[2], const aitensor_t *weights, int8_t channel_axis, void *work_space, aitensor_t *delta_in)
Calculates the gradients of the Conv2D layer with respect to the weights in F32 data type.
void aimath_f32_default_maxpool2d_bwd(const aitensor_t *delta_out, const uint16_t pool_size[2], const uint16_t stride[2], const uint16_t padding[2], int8_t channel_axis, void *work_space, const uint32_t *max_locations, aitensor_t *delta_in)
Calculates the gradients of the MaxPool2D layer with respect to the input in F32 data type.
void aimath_f32_default_batch_norm(const aitensor_t *x, int8_t axis, const aitensor_t *means, const aitensor_t *variances, const aitensor_t *offsets, const aitensor_t *scales, const void *eps, aitensor_t *result)
Batch Normalization on F32 tensors.
void aimath_f32_default_conv2d_add(const aitensor_t *input, const uint16_t stride[2], const uint16_t dilation[2], const int16_t padding[2][2], const aitensor_t *kernel, const void *bias, const uint8_t rotated_kernel, const int16_t *input_use_dims, const int16_t *output_use_dims, const int16_t *kernel_use_dims, aitensor_t *output)
Performs 2D convolution on slices of 4D F32 tensors and adds an optional bias.
void aimath_f32_default_conv2d_bwd(const aitensor_t *x_in, const uint16_t stride[2], const uint16_t dilation[2], const uint16_t padding[2], const aitensor_t *delta_out, int8_t channel_axis, void *work_space, aitensor_t *d_weights)
Calculates the gradients of the Conv2D layer with respect to the weights in F32 data type.
void aimath_f32_default_conv_transpose2d_fwd(const aitensor_t *input, const uint16_t stride[2], const uint16_t dilation[2], const uint16_t padding[2], const uint16_t output_padding[2], const aitensor_t *weights, const aitensor_t *bias, int8_t channel_axis, void *work_space, aitensor_t *output)
Performs 2D transposed convolutions with the given 4D F32 tensors and adds a bias (forward pass of t...
void aimath_f32_default_conv2d_fwd(const aitensor_t *input, const uint16_t stride[2], const uint16_t dilation[2], const uint16_t padding[2], const aitensor_t *weights, const aitensor_t *bias, int8_t channel_axis, void *work_space, aitensor_t *output)
Performs 2D convolutions with the given 4D F32 tensors and adds a bias (forward pass of the Conv2D l...
Definition of the F32 (aif32) data-type.
Math functions for F32 data type, default implementation.
A tensor in AIfES.
Definition: aifes_math.h:89