46 #define AIFES_CHANNELS_FIRST 1
47 #define AIFES_CHANNELS_LAST -1
49 #define AIFES_PADDING_SAME 0xFFFF
50 #define AIFES_PADDING_VALID 0
361 #ifdef AIDEBUG_PRINT_MODULE_SPECS
void ailayer_conv2d_calc_result_shape(ailayer_t *self)
Calculate the shape of the result tensor (ailayer.result)
uint32_t ailayer_conv2d_sizeof_bwdmem(const ailayer_t *self)
Calculate and return the memory size needed for temporary results of the backward pass.
uint32_t ailayer_conv2d_sizeof_trainmem(const ailayer_t *self)
Calculate and return the memory size needed by this layer for training.
const aicore_layertype_t * ailayer_conv2d_type
Conv2D layer type.
void ailayer_conv2d_print_specs(const ailayer_t *self)
Print the layer specification.
void ailayer_conv2d_backward(ailayer_t *self)
Calculate the backward pass for given Conv2D layer.
void ailayer_conv2d_set_paramem(ailayer_t *self, void *memory_ptr)
Distribute provided memory to the parameter pointers.
void ailayer_conv2d_set_trainmem(ailayer_t *self, void *memory_ptr)
Distribute provided memory to the gradients pointers.
uint32_t ailayer_conv2d_sizeof_paramem(const ailayer_t *self)
Calculate and return the parameter memory size needed for this layer.
ailayer_t * ailayer_conv2d(ailayer_conv2d_t *layer, ailayer_t *input_layer)
Initialize and connect the given Conv2D layer.
void ailayer_conv2d_forward(ailayer_t *self)
Calculate the forward pass for given Conv2D layer.
Type indicator of the layer.
Definition: aifes_core.h:82
General Conv2D layer structure.
Definition: ailayer_conv2d.h:57
uint16_t result_shape[4]
The shape of the result.
Definition: ailayer_conv2d.h:92
void(* conv2d_bwd)(const aitensor_t *input, const uint16_t stride[2], const uint16_t dilation[2], const uint16_t padding[2], const aitensor_t *output, int8_t channel_axis, void *work_space, aitensor_t *d_weights)
Required math function: Gradients of 2D-Convolution with respect to the weights.
Definition: ailayer_conv2d.h:146
uint16_t bias_shape[1]
Bias weights tensor shape.
Definition: ailayer_conv2d.h:85
aitensor_t * gradients[2]
Gradients structure for the backpropagation algorithm.
Definition: ailayer_conv2d.h:88
void(* 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)
Required math function: Gradients of 2D-Convolution with respect to the input.
Definition: ailayer_conv2d.h:176
void * optimem[2]
Memory field used by the optimizer for training.
Definition: ailayer_conv2d.h:89
uint32_t filter_count
Number of filters ( ).
Definition: ailayer_conv2d.h:67
void(* 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)
Required math function: 2D-Convolution.
Definition: ailayer_conv2d.h:117
void(* tensor_add)(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Required math function: Element wise tensor addition.
Definition: ailayer_conv2d.h:194
aitensor_t bias
Tensor containing the bias weights.
Definition: ailayer_conv2d.h:82
uint16_t padding[2]
The (symmetric) zero padding in the direction of height and width ( ).
Definition: ailayer_conv2d.h:72
uint16_t stride[2]
The stride in the direction of height and width ( ).
Definition: ailayer_conv2d.h:70
ailayer_t base
Inherited field members from general ailayer struct.
Definition: ailayer_conv2d.h:58
void(* sum_channelwise)(const aitensor_t *x, int8_t channel_axis, aitensor_t *result)
Required math function: Channel-wise sum.
Definition: ailayer_conv2d.h:203
aitensor_t weights
Tensor containing the weights.
Definition: ailayer_conv2d.h:81
uint16_t weights_shape[4]
Weights tensor shape.
Definition: ailayer_conv2d.h:84
uint16_t kernel_size[2]
Size of the kernels ( ).
Definition: ailayer_conv2d.h:68
uint16_t dilation[2]
The dilation in the direction of height and width ( ).
Definition: ailayer_conv2d.h:71
aitensor_t * trainable_params[2]
Pointer to the weights and bias (which are the trainable parameters).
Definition: ailayer_conv2d.h:87
int8_t channel_axis
Index of the channel axis (1 for channels first and -1 or 3 for channels last).
Definition: ailayer_conv2d.h:74
AIfES layer interface.
Definition: aifes_core.h:252
A tensor in AIfES.
Definition: aifes_math.h:89