From 8927fffc356a53ce29f76b0c14cffe15187ebe16 Mon Sep 17 00:00:00 2001 From: ms245755 <michal.szczepanski@cea.fr> Date: Mon, 10 Jun 2024 13:26:17 +0000 Subject: [PATCH] allowDataDependency in resize operator use --- src/operator/Resize.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/operator/Resize.cpp b/src/operator/Resize.cpp index 8ab6669d1..98bffb9e0 100644 --- a/src/operator/Resize.cpp +++ b/src/operator/Resize.cpp @@ -25,7 +25,7 @@ const std::string Aidge::Resize_Op::Type = "Resize"; -bool Aidge::Resize_Op::forwardDims(bool /*allowDataDependency*/) { +bool Aidge::Resize_Op::forwardDims(bool allowDataDependency) { AIDGE_ASSERT(getInput(0)->nbDims() == 4,\ "input tensor must have dimensions = 4 (batch, channel, height, width)."); @@ -35,12 +35,19 @@ bool Aidge::Resize_Op::forwardDims(bool /*allowDataDependency*/) { if (!getInput(i)) { AIDGE_THROW_OR_ABORT(std::runtime_error, "{}: input #{} not provided", type(), i); } + + if (!allowDataDependency) { + Log::warn("Resize_Op: unable to forwardDims() because output dims are data dependent\ + on input#0 and (input#2 or input#3)"); + return false; + } } if (this->template getAttr<ResizeAttr::NoROI>() && this->template getAttr<ResizeAttr::NoSizes>()) { /* - fmt::print("Condition scales: Input 0 and Input 2 must be provided and must have the same dimension, while Inputs 1 and 3 must not be provided.\n"); + fmt::print("Condition scales: Input#0 and Input#2 must be provided and must have the same dimension,\ + while Inputs#1 and #3 must not be provided.\n"); */ AIDGE_ASSERT(getInput(0)->nbDims() == getInput(2)->size(),\ @@ -62,7 +69,8 @@ bool Aidge::Resize_Op::forwardDims(bool /*allowDataDependency*/) { if (this->template getAttr<ResizeAttr::NoROI>() && this->template getAttr<ResizeAttr::NoScales>()) { /* - fmt::print("Condition sizes: Input 0 and Input 3 must be provided and must have the same dimension, while Inputs 1 and 2 must not be provided.\n"); + fmt::print("Condition sizes: Input#0 and Input#3 must be provided and must have the same dimension,\ + while Inputs#1 and #2 must not be provided.\n"); */ AIDGE_ASSERT(getInput(0)->nbDims() == getInput(3)->size(),\ -- GitLab