Skip to content
Snippets Groups Projects
Commit 302ebd03 authored by Benjamin Halimi's avatar Benjamin Halimi
Browse files

draft the determineBackend() routine

parent 6a773234
No related branches found
No related tags found
2 merge requests!54Update 0.3.1 -> 0.4.0,!48Hotfix the default backend issue
Pipeline #67695 passed
......@@ -111,6 +111,35 @@ static std::shared_ptr<Aidge::Node> getUniqueChildren(std::shared_ptr<Aidge::Nod
return *(childrenSet.begin());
}
static std::string determineBackend(std::shared_ptr<Aidge::Node> node)
{
std::string backend = node->getOperator()->backend();
if (backend != "")
return backend;
else
{
// gather the parent backends
std::set<std::string> parentBackends;
for (auto parent : node->getParents())
parentBackends.insert(determineBackend(parent)); // it always answers a non empty value !
// check if we have two or more different backends gathered
if (parentBackends.size() > 1)
{
Log::warn(" Unable to determine backend of node {} due to conflicting parent ones !", node->name());
return (*parentBackends.begin());
}
// if all parents have the same backend return it
if (parentBackends.size() == 1)
return (*parentBackends.begin());
}
}
static int getInputIndex(std::shared_ptr<Node> node, std::shared_ptr<Node> parentNode)
{
int index = 0;
......
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