pg020196 / Neural-Network-Translator

This repository contains a neural network translator which can translate neural network models to native code.
MIT License
8 stars 4 forks source link

Review calculation of output dimensions in backend_utils for pooling layers #86

Closed ChristophBrandl closed 4 years ago

ChristophBrandl commented 4 years ago

Method get_output_dimensions produced the following dimension information in .h-file output for avgpool2d: const uint16_t LAYER_OUTPUT_WIDTH[5] = {28,14.5,1,1,1}; const uint16_t LAYER_OUTPUT_HEIGHT[5] = {28,14.5,210.25,128,10};

Wrong height 210.25 is a consequence of the false height (14.5) and width (14.5) calculated for the avgpool2d layer. Maybe the algorithm has to floor or round the calculated widths and heights.

Please review the algorithm in method get_output_dimensions in backend_utils.

ChristophBrandl commented 4 years ago

@pg020196 Maybe you can have a look, if the algorithm is correctly implemented or if there are any differences to the implementation in the c-code.

pg020196 commented 4 years ago

@ChristophBrandl Maybe this results from the different data types the calculation is performed in. The c-code uses integer division where as the backend util - as far as I know - uses floating point division. I‘ll check out the algorithm tomorrow.