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

Fix: attribute access for 'MetaOperator'

parent 3c4b68ec
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,10 @@ public:
std::shared_ptr<SequentialScheduler> mScheduler;
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 = {});
/**
......@@ -92,7 +95,7 @@ public:
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 getNbRequiredProtected(const IOIndex_t inputIdx) const override;
......
......@@ -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));
}
}
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 {
......@@ -119,22 +123,6 @@ std::set<std::string> Aidge::MetaOperator_Op::getAvailableBackends() const {
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 {
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