From 69daf69e46d7b29fd15ac6adab04160300ddc517 Mon Sep 17 00:00:00 2001
From: Olivier BICHLER <olivier.bichler@cea.fr>
Date: Thu, 29 Feb 2024 17:16:37 +0100
Subject: [PATCH] Fixed a bug with meta op computeOutputDims()

---
 include/aidge/operator/MetaOperator.hpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/aidge/operator/MetaOperator.hpp b/include/aidge/operator/MetaOperator.hpp
index 9290e7957..7f36eca2c 100644
--- a/include/aidge/operator/MetaOperator.hpp
+++ b/include/aidge/operator/MetaOperator.hpp
@@ -74,8 +74,17 @@ public:
     }
 
     void computeOutputDims() override final {
-        // Forward dims of micro-graph
-        mGraph->forwardDims();
+        // Check first that all required inputs are available, otherwise
+        // mGraph->forwardDims() will fail!
+        bool forwarded = true;
+        for (IOIndex_t i = 0; i < nbInputs(); ++i) {
+            forwarded &= mInputs[i] ? !(getInput(i)->empty()) : false;
+        }
+
+        if (forwarded) {
+            // Forward dims of micro-graph
+            mGraph->forwardDims();
+        }
     }
 
 
-- 
GitLab