File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
hls4ml/model/optimizer/passes Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -542,6 +542,24 @@ def _(node: UnaryLUT):
542542 default_register_precision (node )
543543
544544
545+ @register_precision .register (Pooling1D )
546+ @register_precision .register (Pooling2D )
547+ @register_precision .register (GlobalPooling1D )
548+ @register_precision .register (GlobalPooling2D )
549+ def _ (node : Pooling1D | Pooling2D | GlobalPooling1D | GlobalPooling2D ):
550+ default_register_precision (node )
551+ pool_op = node .attributes ['pool_op' ]
552+ if pool_op != 'Average' :
553+ return
554+ if isinstance (node , (Pooling1D , GlobalPooling1D )):
555+ px_shape = (node .attributes ['pool_width' ],)
556+ else :
557+ px_shape = (node .attributes ['pool_height' ], node .attributes ['pool_width' ])
558+ i_add = int (log2 (prod (px_shape )))
559+ node .attributes ['accum_t' ].precision .width += i_add
560+ node .attributes ['accum_t' ].precision .integer += i_add
561+
562+
545563class BitExact (ModelOptimizerPass ):
546564 def __init__ (self ):
547565 pass
You can’t perform that action at this time.
0 commit comments