diff --git a/include/aidge/graph/GraphView.hpp b/include/aidge/graph/GraphView.hpp index 682634015376bf309a015046decfa40a36e2b177..73dc7950daec42b803a3e14f596725a6ede34658 100644 --- a/include/aidge/graph/GraphView.hpp +++ b/include/aidge/graph/GraphView.hpp @@ -400,10 +400,17 @@ public: addChild(toOtherNode, mNodeRegistry.at(fromOutNodeName), fromTensor, toTensor); } - inline void updateNodeName(const std::string& oldName, const std::string& newName){ - AIDGE_ASSERT(mNodeRegistry.find(oldName) != mNodeRegistry.end(), "No node named {} in graph {}, the graph may be corrupted !", oldName, name()); - mNodeRegistry[newName] = mNodeRegistry[oldName]; - mNodeRegistry.erase(oldName); + inline void updateNodeName(NodePtr nodeToRename, const std::string& newName){ + const std::string& oldName = nodeToRename->name(); + AIDGE_ASSERT(mNodeRegistry.find(newName) != mNodeRegistry.end(), "Name {} is already used in graph {}.", newName, name()); + + if (nodeToRename->name() != ""){ // Case node already had a name + AIDGE_ASSERT(mNodeRegistry.find(oldName) != mNodeRegistry.end(), "No node named {} in graph {}, the graph may be corrupted !", oldName, name()); + mNodeRegistry[newName] = mNodeRegistry[oldName]; + mNodeRegistry.erase(oldName); + }else{ // Case node did not had a name + mNodeRegistry[newName] = nodeToRename; + } } /** diff --git a/include/aidge/operator/MetaOperator.hpp b/include/aidge/operator/MetaOperator.hpp index 73a5c6a99fc06640df4f984dd8b8a291c3b3d783..744564b4bd591d84b871a6af71c4a54589103485 100644 --- a/include/aidge/operator/MetaOperator.hpp +++ b/include/aidge/operator/MetaOperator.hpp @@ -108,6 +108,7 @@ public: Elts_t getNbProducedData(IOIndex_t outputIdx) const override; void updateConsummerProducer() override; + void resetConsummerProducer() override; void forward() override; void backward() override { AIDGE_THROW_OR_ABORT(std::runtime_error, "backward() not implemented yet for a MetaOperator"); diff --git a/src/graph/Node.cpp b/src/graph/Node.cpp index 50b8be13c6faac62a8b2aecf1e767e0b83024d3c..7fe155b5a2b9b42a1504dbb592b2326d13b99c1e 100644 --- a/src/graph/Node.cpp +++ b/src/graph/Node.cpp @@ -64,7 +64,7 @@ Aidge::Connector Aidge::Node::operator()(const std::vector<Connector>& ctors) { /////////////////////////////////////////////////////// void Aidge::Node::setName(const std::string& name) { - for (auto graphView : views()) graphView->updateNodeName(mName, name); + for (auto graphView : views()) graphView->updateNodeName(shared_from_this(), name); mName = name; } diff --git a/src/operator/MetaOperator.cpp b/src/operator/MetaOperator.cpp index 7362f67fcce97cc6861edd2b334758801d060ade..e7c50033797c7c984b6b8da69d30f005bc69e70c 100644 --- a/src/operator/MetaOperator.cpp +++ b/src/operator/MetaOperator.cpp @@ -134,6 +134,20 @@ Aidge::Elts_t Aidge::MetaOperator_Op::getNbProducedData(IOIndex_t outputIdx) con } } +void Aidge::MetaOperator_Op::resetConsummerProducer() { + if (mImpl) { + mImpl->resetConsummerProducer(); + } + else { + if (!mScheduler) { + // Lazy initialization + mScheduler = std::make_shared<SequentialScheduler>(mGraph, mUpperNode.lock()); + } + + mScheduler->resetScheduling(); + } +} + void Aidge::MetaOperator_Op::updateConsummerProducer() { if (mImpl) { mImpl->updateConsummerProducer(); diff --git a/src/operator/Slice.cpp b/src/operator/Slice.cpp index 4c42280cad77f93a706d731894326ff8bb411a27..3cc2de686435a304326e2a4a60dad6c12a50349c 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->ends()[i] + static_cast<DimSize_t>(getInput(0)->dims()[axis])); const std::int64_t step = this->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->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; }