Skip to content

Accumulate with wider data type in AveragePooling

Javier Duarte requested to merge github/fork/jmduarte/avg_pool into master
  • Addresses #311 (closed)
  • Uses accum_t to accumulate in average pooling
  • Not yet propagated to global average pooling, because I couldn't figure out how to do it there as easily

You can test this with this gist: https://gist.github.com/jmduarte/2bb7ccb8c3028056ef3bdd7f2579250b

The Keras output is

[17.974936   9.814308   4.8630896]

The default hls4ml output with ap_fixed<10,7,AP_SAT,AP_RND> is

[0.875 0.875 0.875]

With the accum_t additionally specified as ap_fixed<16,13> (made larger by 6 bits because the sum goes over 2^6 = 64 elements), the output is instead:

[17.875  9.75   4.75 ]

Merge request reports

Loading