From 512b5c5018ec51541eecde9b8b01fd068b85a2c7 Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <yamanu@xilinx.com>
Date: Wed, 23 Mar 2022 17:06:39 +0000
Subject: [PATCH] [Lookup] fix from Thomas for external lookup behavior

---
 src/finn/custom_op/fpgadataflow/lookup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/finn/custom_op/fpgadataflow/lookup.py b/src/finn/custom_op/fpgadataflow/lookup.py
index 073105253..1a2945ea9 100644
--- a/src/finn/custom_op/fpgadataflow/lookup.py
+++ b/src/finn/custom_op/fpgadataflow/lookup.py
@@ -258,7 +258,7 @@ class Lookup(HLSCustomOp):
             ]
         elif mem_mode == "external":
             hls_impl = """
-    for(unsigned  i = 0; i < NumInputs; i++) {
+    if(!in0.empty()) {
         ap_uint<T_SRC::width+EmbeddingAlign> const  base =
             (in0.read(), ap_uint<EmbeddingAlign>(0));
         for(unsigned  j = 0; j < EmbeddingSize; j++) {
-- 
GitLab