From c335e9ab595996d1dcb03e1c659dedfe10267075 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Thu, 2 Jul 2020 16:18:00 +0200
Subject: [PATCH] Corrected bug in ContextualModule

---
 torch_modules/src/ContextualModule.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/torch_modules/src/ContextualModule.cpp b/torch_modules/src/ContextualModule.cpp
index 12fbdac..ebe386a 100644
--- a/torch_modules/src/ContextualModule.cpp
+++ b/torch_modules/src/ContextualModule.cpp
@@ -173,11 +173,15 @@ void ContextualModuleImpl::addToContext(std::vector<std::vector<long>> & context
   for (auto index : targetIndexes)
   {
     if (configIndex2ContextIndex.count(index))
+    {
       for (auto & contextElement : context)
-        contextElement.push_back(configIndex2ContextIndex.at(index)+1);
+        contextElement.push_back(configIndex2ContextIndex.at(index));
+    }
     else
+    {
       for (auto & contextElement : context)
         contextElement.push_back(0);
+    }
   }
 }
 
-- 
GitLab