Skip to content
Snippets Groups Projects
Commit f43905b6 authored by Maxence Naud's avatar Maxence Naud
Browse files

Merge branch 'fix_208-bad-metaop-attributes' into 'dev'

Resolve "Bad MetaOp attributes"

See merge request !268
parents 3c4b68ec 819554a1
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,10 @@ public: ...@@ -36,7 +36,10 @@ public:
std::shared_ptr<SequentialScheduler> mScheduler; std::shared_ptr<SequentialScheduler> mScheduler;
std::weak_ptr<Node> mUpperNode; std::weak_ptr<Node> mUpperNode;
public: private:
const std::shared_ptr<DynamicAttributes> mAttributes = std::make_shared<DynamicAttributes>();
public:
MetaOperator_Op(const std::string& type, const std::shared_ptr<GraphView>& graph, const std::vector<InputCategory>& forcedInputsCategory = {}); MetaOperator_Op(const std::string& type, const std::shared_ptr<GraphView>& graph, const std::vector<InputCategory>& forcedInputsCategory = {});
/** /**
...@@ -92,7 +95,7 @@ public: ...@@ -92,7 +95,7 @@ public:
mGraph->setDataType(datatype); mGraph->setDataType(datatype);
} }
std::shared_ptr<Attributes> attributes() const override; inline std::shared_ptr<Attributes> attributes() const override { return mAttributes; }
Elts_t getNbRequiredData(const IOIndex_t inputIdx) const override; Elts_t getNbRequiredData(const IOIndex_t inputIdx) const override;
Elts_t getNbRequiredProtected(const IOIndex_t inputIdx) const override; Elts_t getNbRequiredProtected(const IOIndex_t inputIdx) const override;
......
...@@ -48,6 +48,10 @@ Aidge::MetaOperator_Op::MetaOperator_Op(const std::string& type, const std::shar ...@@ -48,6 +48,10 @@ Aidge::MetaOperator_Op::MetaOperator_Op(const std::string& type, const std::shar
mOutputs[outputIdx] = std::dynamic_pointer_cast<Tensor>(outputOp.first->getOperator()->getRawOutput(outputOp.second)); mOutputs[outputIdx] = std::dynamic_pointer_cast<Tensor>(outputOp.first->getOperator()->getRawOutput(outputOp.second));
} }
} }
for (const auto& node : mGraph->getRankedNodesName("{1}_{3}")) {
mAttributes->addAttr(node.second, node.first->getOperator()->attributes());
}
} }
std::shared_ptr<Aidge::Operator> Aidge::MetaOperator_Op::clone() const { std::shared_ptr<Aidge::Operator> Aidge::MetaOperator_Op::clone() const {
...@@ -119,22 +123,6 @@ std::set<std::string> Aidge::MetaOperator_Op::getAvailableBackends() const { ...@@ -119,22 +123,6 @@ std::set<std::string> Aidge::MetaOperator_Op::getAvailableBackends() const {
return backendsList; return backendsList;
} }
std::shared_ptr<Aidge::Attributes> Aidge::MetaOperator_Op::attributes() const {
auto attrs = std::make_shared<DynamicAttributes>();
for (const auto& node : mGraph->getRankedNodesName("{3}")) {
const auto attributes = node.first->getOperator()->attributes();
if (attributes) {
const auto nodeAttrs = DynamicAttributes(attributes->getAttrs());
attrs->addAttr(node.first->type() + "#" + node.second, nodeAttrs);
if (node.second == "0") {
attrs->addAttr(node.first->type(), nodeAttrs);
}
}
}
return attrs;
}
Aidge::Elts_t Aidge::MetaOperator_Op::getNbRequiredData(const IOIndex_t inputIdx) const { Aidge::Elts_t Aidge::MetaOperator_Op::getNbRequiredData(const IOIndex_t inputIdx) const {
if (mImpl) { if (mImpl) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment