From 19dce7902ca1eb47d935f2d464e650b8508cde62 Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Thu, 29 Aug 2024 14:54:09 +0200 Subject: [PATCH] Fixed issues --- src/backend/OperatorImpl.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/OperatorImpl.cpp b/src/backend/OperatorImpl.cpp index ed64f5695..863aa21bb 100644 --- a/src/backend/OperatorImpl.cpp +++ b/src/backend/OperatorImpl.cpp @@ -86,7 +86,8 @@ Aidge::ImplSpec Aidge::OperatorImpl::getBestMatch(const ImplSpec& requiredSpecs) // Check inputs for (size_t i = 0; i < requiredSpecs.inputs.size(); ++i) { - if (!checkIOSpec(requiredSpecs.inputs[i], spec.inputs[i])) { + const auto inputSpec = (i < spec.inputs.size()) ? spec.inputs[i] : spec.inputs.back(); + if (!checkIOSpec(requiredSpecs.inputs[i], inputSpec)) { match = false; break; } @@ -94,7 +95,8 @@ Aidge::ImplSpec Aidge::OperatorImpl::getBestMatch(const ImplSpec& requiredSpecs) // Check outputs for (size_t i = 0; i < requiredSpecs.outputs.size(); ++i) { - if (!checkIOSpec(requiredSpecs.outputs[i], spec.outputs[i])) { + const auto outputSpec = (i < spec.outputs.size()) ? spec.outputs[i] : spec.outputs.back(); + if (!checkIOSpec(requiredSpecs.outputs[i], outputSpec)) { match = false; break; } @@ -171,7 +173,13 @@ bool Aidge::OperatorImpl::checkIOSpec(const ImplSpec::IOSpec& required, const Im && spec.format != DataFormat::Any && required.format != spec.format) { - return false; + const auto transpose = getDataFormatTranspose(required.format, spec.format); + std::vector<size_t> identity(transpose.size()); + std::iota(std::begin(identity), std::end(identity), 0); + + if (!std::equal(transpose.begin(), transpose.end(), identity.begin())) { + return false; + } } if (!required.dims.empty() && !spec.dims.empty()) { -- GitLab