38 #ifndef AILAYER_MAXPOOL2D_H
39 #define AILAYER_MAXPOOL2D_H
43 #define AIFES_CHANNELS_FIRST 1
44 #define AIFES_CHANNELS_LAST -1
228 #ifdef AIDEBUG_PRINT_MODULE_SPECS
void ailayer_maxpool2d_set_trainmem(ailayer_t *self, void *memory_ptr)
Distribute provided memory to the gradients pointers.
ailayer_t * ailayer_maxpool2d(ailayer_maxpool2d_t *layer, ailayer_t *input_layer)
Initialize and connect the given MaxPool2D layer.
void ailayer_maxpool2d_forward(ailayer_t *self)
Calculate the forward pass for given MaxPool2D layer.
uint32_t ailayer_maxpool2d_sizeof_trainmem(const ailayer_t *self)
Calculate and return the memory size needed by this layer for training.
const aicore_layertype_t * ailayer_maxpool2d_type
MaxPool2D layer type.
void ailayer_maxpool2d_backward(ailayer_t *self)
Calculate the backward pass for given MaxPool2D layer.
void ailayer_maxpool2d_calc_result_shape(ailayer_t *self)
Calculate the shape of the result tensor (ailayer.result)
void ailayer_maxpool2d_print_specs(const ailayer_t *self)
Print the layer specification.
Type indicator of the layer.
Definition: aifes_core.h:82
General layer structure.
Definition: ailayer_maxpool2d.h:51
uint16_t result_shape[4]
The shape of the result.
Definition: ailayer_maxpool2d.h:138
uint32_t * max_locations
Pointer to memory section where the indices of the maximum values per pooling window are stored.
Definition: ailayer_maxpool2d.h:73
void * optimem[2]
Memory field used by the optimizer for training.
Definition: ailayer_maxpool2d.h:75
void(* 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)
Required math function: 2D Max-Pooling.
Definition: ailayer_maxpool2d.h:99
uint16_t padding[2]
The (symmetric) minus infinity padding in the direction of height and width ( ).
Definition: ailayer_maxpool2d.h:63
void(* 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)
Required math function: Gradients of 2D Max-Pooling with respect to the input.
Definition: ailayer_maxpool2d.h:126
uint16_t stride[2]
The stride in the direction of height and width ( ).
Definition: ailayer_maxpool2d.h:62
ailayer_t base
Inherited field members from general ailayer struct.
Definition: ailayer_maxpool2d.h:52
uint16_t pool_size[2]
Size of the pooling kernel ( ).
Definition: ailayer_maxpool2d.h:61
int8_t channel_axis
Index of the channel axis (1 for channels first and -1 or 3 for channels last).
Definition: ailayer_maxpool2d.h:65
AIfES layer interface.
Definition: aifes_core.h:252
A tensor in AIfES.
Definition: aifes_math.h:89