From bc968b8950a5ab36225d13db54f335785d0c5815 Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Fri, 28 Jun 2024 13:47:27 +0200 Subject: [PATCH] Clarified Slice errors --- src/operator/Slice.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/operator/Slice.cpp b/src/operator/Slice.cpp index 11e3ac089..e3040ba26 100644 --- a/src/operator/Slice.cpp +++ b/src/operator/Slice.cpp @@ -147,13 +147,13 @@ bool Aidge::Slice_Op::forwardDims(bool allowDataDependency) { static_cast<DimSize_t>(this->template getAttr<SliceAttr::Ends>()[i] + static_cast<DimSize_t>(getInput(0)->dims()[axis])); const std::int64_t step = this->template getAttr<SliceAttr::Steps>()[i]; - AIDGE_ASSERT(step != 0, "Slice_Op: Step must be a non-zero value!"); + AIDGE_ASSERT(step != 0, "Slice_Op: Step ({}) must have a non-zero value on axis {}!", this->template getAttr<SliceAttr::Steps>(), axis); if(step * (static_cast<int64_t>(end) - static_cast<int64_t>(start)) < 0) { if(step < 0) { - AIDGE_THROW_OR_ABORT(std::runtime_error, "{}: Step is negative we must have End < Start", type()); + AIDGE_THROW_OR_ABORT(std::runtime_error, "{}: Step ({}) is negative, we must have End ({}) < Start ({}) on axis {}", type(), step, end, start, axis); } else { - AIDGE_THROW_OR_ABORT(std::runtime_error, "{}: Step is positive we must have Start < End", type()); + AIDGE_THROW_OR_ABORT(std::runtime_error, "{}: Step ({}) is positive, we must have Start ({}) < End ({}) on axis {}", type(), step, start, end, axis); } } @@ -161,7 +161,8 @@ bool Aidge::Slice_Op::forwardDims(bool allowDataDependency) { // Check if slice length is valid if (sliceLength > getInput(0)->dims()[axis]) { - AIDGE_THROW_OR_ABORT(std::runtime_error, "Slice_Op: ROI of Slice operator out of bounds"); + AIDGE_THROW_OR_ABORT(std::runtime_error, "Slice_Op: ROI ({}) of Slice operator out of bounds ({}) on axis {}, with (Start, End, Step) = ({}, {}, {})", + sliceLength, getInput(0)->dims()[axis], axis, start, end, step); } outDims[axis] = sliceLength; } -- GitLab