From 54de6a238ed18c0d0083862083c47afc754ea68b Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Tue, 28 Jul 2020 01:10:14 +0200
Subject: [PATCH] [HLSCustomOp] update expected cycles for
 StreamingMaxPool_Batch

based on loop nest
---
 src/finn/custom_op/fpgadataflow/streamingmaxpool_batch.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/finn/custom_op/fpgadataflow/streamingmaxpool_batch.py b/src/finn/custom_op/fpgadataflow/streamingmaxpool_batch.py
index 266870a1b..4c7723586 100644
--- a/src/finn/custom_op/fpgadataflow/streamingmaxpool_batch.py
+++ b/src/finn/custom_op/fpgadataflow/streamingmaxpool_batch.py
@@ -96,8 +96,10 @@ class StreamingMaxPool_Batch(HLSCustomOp):
         return np.prod(folded_oshape[:-1])
 
     def get_exp_cycles(self):
-        # Channels * batch size * odim * odim
-        return np.prod(self.get_folded_output_shape()[:-1])
+        # derived from StreamingMaxPool_Batch loop nest
+        k = self.get_nodeattr("PoolDim")
+        ifm_dim = self.get_nodeattr("ImgDim")
+        return ifm_dim * (ifm_dim + (ifm_dim / k))
 
     def get_instream_width(self):
         dt_bits = self.get_input_datatype().bitwidth()
-- 
GitLab