Skip to content
Snippets Groups Projects

Draft: Learning

Merged Maxence Naud requested to merge learning into main
1 file
+ 40
0
Compare changes
  • Side-by-side
  • Inline
+ 40
0
 
/********************************************************************************
 
* Copyright (c) 2023 CEA-List
 
*
 
* This program and the accompanying materials are made available under the
 
* terms of the Eclipse Public License 2.0 which is available at
 
* http://www.eclipse.org/legal/epl-2.0.
 
*
 
* SPDX-License-Identifier: EPL-2.0
 
*
 
********************************************************************************/
 
 
#ifndef AIDGE_CORE_UTILS_RECIPIES_H_
 
#define AIDGE_CORE_UTILS_RECIPIES_H_
 
 
#include <memory>
 
#include <set>
 
 
#include "aidge/graph/Node.hpp"
 
#include "aidge/graph/GraphView.hpp"
 
 
 
namespace Aidge {
 
 
/**
 
* @brief Getter for every Producer operator in a GraphView.
 
* @param graphview GraphView instance where Producers should be searched.
 
* @return std::set<std::shared_ptr<Node>>
 
*/
 
std::set<std::shared_ptr<Aidge::Node>> producers(std::shared_ptr<Aidge::GraphView> graphview) {
 
std::set<std::shared_ptr<Node>> res;
 
const std::set<std::shared_ptr<Node>> nodes = graphview->getNodes();
 
 
std::copy_if(nodes.cbegin(),
 
nodes.cend(),
 
std::inserter(res, res.begin()),
 
[](std::shared_ptr<Node> n){ return n->type() == "Producer"; });
 
 
return res;
 
}
 
} // namespace Aidge
 
\ No newline at end of file
Loading