From 9ab6a60cdce08f6f565fba5f1e858befb4e3fe78 Mon Sep 17 00:00:00 2001
From: auphelia <jakobapk@web.de>
Date: Tue, 29 Oct 2019 08:57:54 +0000
Subject: [PATCH] Changed compare function back to separate function in
 multi-thresholding

---
 src/finn/core/multi_thresholding.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/finn/core/multi_thresholding.py b/src/finn/core/multi_thresholding.py
index a8f76d686..0a88fa18b 100755
--- a/src/finn/core/multi_thresholding.py
+++ b/src/finn/core/multi_thresholding.py
@@ -1,6 +1,13 @@
 import numpy as np
 
 
+def compare(x, y):
+    if x >= y:
+        return 1.0
+    else:
+        return 0.0
+
+
 def execute(v, thresholds):
     # reshape inputs to enable channel-wise reading
     vr = v.reshape((thresholds.shape[1], -1))
@@ -27,9 +34,9 @@ def execute(v, thresholds):
         for c in range(thresholds.shape[1]):
             for ce0 in range(vr.shape[0]):
                 for ce1 in range(ce1_low_lim, ce1_up_lim):
-                    # ret[ce0][ce1] += compare(vr[ce0][ce1], t[c])
-                    ret[ce0][ce1] += map(
-                        lambda x: 1.0 if x is True else 0.0, vr[ce0][ce1] >= t[c]
-                    )
+                    ret[ce0][ce1] += compare(vr[ce0][ce1], t[c])
+                # ret[ce0][ce1] += map(
+                # 	lambda x: 1.0 if x is True else 0.0, vr[ce0][ce1] >= t[c]
+                # )
 
         return ret.reshape(v.shape)
-- 
GitLab