max pooling in c++
for (size_t y = 0; y < out_height; ++y) { for (size_t x = 0; x < out_width; ++x) { for (size_t i = 0; i < pool_y; ++i) { for (size_t j = 0; j < pool_x; ++j) { for (size_t c = 0; c < depth; ++c) { float value = in[y * pool_y + i][x * pool_x + j][c]; out[y][x][c] = max(out[y][x][c], value); } } } } }
Source: thebreakfastpost.com