| AIfES 2 2.0.0

Typedefs | Functions
ailayer_maxpool2d_default.h File Reference

Default implementation of the MaxPool2D layer . More...

Go to the source code of this file.

## Typedefs
typedef struct ailayer_maxpool2d | ailayer_maxpool2d_f32_t

## Functions
ailayer_t * | ailayer_maxpool2d_f32_default (ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
| Initializes and connect a Conv2D layer with the F32 default implementation. More...
ailayer_t * | ailayer_maxpool2d_cfirst_f32_default (ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
| Initializes and connect a MaxPool2D layer (channels first) with the F32 default implementation. More...
ailayer_t * | ailayer_maxpool2d_chw_f32_default (ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
| Initializes and connect a MaxPool2D layer (channels first) with the F32 default implementation. More...
ailayer_t * | ailayer_maxpool2d_clast_f32_default (ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
| Initializes and connect a MaxPool2D layer (channels last) with the F32 default implementation. More...
ailayer_t * | ailayer_maxpool2d_hwc_f32_default (ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
| Initializes and connect a MaxPool2D layer (channels last) with the F32 default implementation. More...

## Detailed Description

Default implementation of the MaxPool2D layer .

Version
  2.2.0

Date
  18.10.2021

Copyright
  Copyright (C) 2020-2023 Fraunhofer Institute for Microelectronic Circuits and Systems. All rights reserved.
  AIfES is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
  You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Hardware independent implementations of the MaxPool2D layer in F32 data-type. For more information about the MaxPool2D layer refer to ailayer_maxpool2d.h.

## Function Documentation

## ◆ ailayer_maxpool2d_cfirst_f32_default()

ailayer_t* ailayer_maxpool2d_cfirst_f32_default | ( | ailayer_maxpool2d_f32_t * | layer,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a MaxPool2D layer (channels first) with the F32 default implementation.

Code examples are given in the description of ailayer_maxpool2d_f32_default().

Parameters

  *layer | The layer structure to initialize.
  *input_layer | The prior layer.

Returns
  The (successfully) initialized layer structure.

## ◆ ailayer_maxpool2d_chw_f32_default()

ailayer_t* ailayer_maxpool2d_chw_f32_default | ( | ailayer_maxpool2d_f32_t * | layer,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a MaxPool2D layer (channels first) with the F32 default implementation.

Code examples are given in the description of ailayer_maxpool2d_f32_default().

Parameters

  *layer | The layer structure to initialize.
  *input_layer | The prior layer.

Returns
  The (successfully) initialized layer structure.

## ◆ ailayer_maxpool2d_clast_f32_default()

ailayer_t* ailayer_maxpool2d_clast_f32_default | ( | ailayer_maxpool2d_f32_t * | layer,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a MaxPool2D layer (channels last) with the F32 default implementation.

Code examples are given in the description of ailayer_maxpool2d_f32_default().

Parameters

  *layer | The layer structure to initialize.
  *input_layer | The prior layer.

Returns
  The (successfully) initialized layer structure.

## ◆ ailayer_maxpool2d_f32_default()

ailayer_t* ailayer_maxpool2d_f32_default | ( | ailayer_maxpool2d_f32_t * | layer,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a Conv2D layer with the F32 default implementation.

Example: Create the layer structure:
In C:

ailayer_maxpool2d_f32_t maxpool2d_layer = {
.pool_size = {2, 2},
.stride = {2, 2},
.padding = {0, 0}
};
ailayer_maxpool2d
General layer structure.
Definition: ailayer_maxpool2d.h:51
ailayer_maxpool2d::pool_size
uint16_t pool_size[2]
Size of the pooling kernel ( ).
Definition: ailayer_maxpool2d.h:61

In C, C++ and on Arduino:

ailayer_maxpool2d_t maxpool2d_layer = AILAYER_CONV2D_F32_A(
/* pool_size =*/ HW(2, 2),
/* stride =*/ HW(2, 2),
/* padding =*/ HW(0, 0)
);

Example: Initialize and connect the layer for data with channels first (all options are equivalent):

maxpool2d_layer.channel_axis = 1;
x = ailayer_maxpool2d_f32_default(&maxpool2d_layer, x);
ailayer_maxpool2d_f32_default
ailayer_t * ailayer_maxpool2d_f32_default(ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
Initializes and connect a Conv2D layer with the F32 default implementation.
ailayer_maxpool2d::channel_axis
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

or

x = ailayer_maxpool2d_cfirst_f32_default(&maxpool2d_layer, x);
ailayer_maxpool2d_cfirst_f32_default
ailayer_t * ailayer_maxpool2d_cfirst_f32_default(ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
Initializes and connect a MaxPool2D layer (channels first) with the F32 default implementation.

or

x = ailayer_maxpool2d_chw_f32_default(&maxpool2d_layer, x);
ailayer_maxpool2d_chw_f32_default
ailayer_t * ailayer_maxpool2d_chw_f32_default(ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
Initializes and connect a MaxPool2D layer (channels first) with the F32 default implementation.

Example: Initialize and connect the layer for data with channels last (all options are equivalent):

maxpool2d_layer.channel_axis = -1;
x = ailayer_maxpool2d_f32_default(&maxpool2d_layer, x);

or

x = ailayer_maxpool2d_clast_f32_default(&maxpool2d_layer, x);
ailayer_maxpool2d_clast_f32_default
ailayer_t * ailayer_maxpool2d_clast_f32_default(ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
Initializes and connect a MaxPool2D layer (channels last) with the F32 default implementation.

or

x = ailayer_maxpool2d_hwc_f32_default(&maxpool2d_layer, x);
ailayer_maxpool2d_hwc_f32_default
ailayer_t * ailayer_maxpool2d_hwc_f32_default(ailayer_maxpool2d_f32_t *layer, ailayer_t *input_layer)
Initializes and connect a MaxPool2D layer (channels last) with the F32 default implementation.

Parameters

  *layer | The layer structure to initialize.
  *input_layer | The prior layer.

Returns
  The (successfully) initialized layer structure.

## ◆ ailayer_maxpool2d_hwc_f32_default()

ailayer_t* ailayer_maxpool2d_hwc_f32_default | ( | ailayer_maxpool2d_f32_t * | layer,
|  | ailayer_t * | input_layer
| ) |  |

Initializes and connect a MaxPool2D layer (channels last) with the F32 default implementation.

Code examples are given in the description of ailayer_maxpool2d_f32_default().

Parameters

  *layer | The layer structure to initialize.
  *input_layer | The prior layer.

Returns
  The (successfully) initialized layer structure.