From 7bc22c784d38e6739f8c1c1012d76e8bf2cd5ce4 Mon Sep 17 00:00:00 2001 From: cmoineau <cyril.moineau@cea.fr> Date: Fri, 12 Jan 2024 15:33:23 +0000 Subject: [PATCH] Fix issue with Identity nb output. --- include/aidge/operator/Identity.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/aidge/operator/Identity.hpp b/include/aidge/operator/Identity.hpp index 7348fa10a..57cd20311 100644 --- a/include/aidge/operator/Identity.hpp +++ b/include/aidge/operator/Identity.hpp @@ -40,7 +40,7 @@ public: static const std::string Type; Identity_Op() - : OperatorTensor(Type, 1, 0, 0) + : OperatorTensor(Type, 1, 0, 1) { mImpl = std::make_shared<OperatorImpl>(*this); } @@ -101,7 +101,10 @@ public: if (outputIdx >= nbInputs()) { AIDGE_THROW_OR_ABORT(std::runtime_error, "%s Operator has %hu outputs", type().c_str(), nbInputs()); } - return mInputs[outputIdx]; + if (mInputs[outputIdx] == nullptr){ + return mOutputs[outputIdx]; // Input is not initialized with empty tensor + } + return mInputs[outputIdx]; // Identity, so Output is Input } void setBackend(const std::string& /*name*/, DeviceIdx_t /*device*/ = 0) override final { // setBackend do nothing, Identity node has no backend it just pass the same Tensor -- GitLab