23#include <unordered_set>
24#include <unordered_map>
43 auto op =
new T(std::forward<Args>(args)...);
44 op->setId(_last_node_id++);
56 op->
setId(_last_node_id++);
67 std::unordered_set<Operation *>
getNodes()
const {
return _ops; }
73 std::vector<ops::InputOp *>
getInputs()
const {
return _inputs; }
79 std::vector<ops::OutputOp *>
getOutputs()
const {
return _outputs; }
97 std::unordered_set<Operation *> _ops;
98 size_t _last_node_id = 0;
100 std::vector<ops::InputOp *> _inputs;
101 std::vector<ops::OutputOp *> _outputs;
void replaceNode(Operation *op, Operation *with)
Subsitude node in graph with another keeping all edges.
std::unordered_set< Operation * > getNodes() const
Returns all graph nodes.
Operation * copyOpWithInputs(Operation *old_op, const std::vector< Operation::Output * > &inputs)
Copies old_op with new inputs and registers it into graph.
void removeNode(Operation *op)
remove node from graph, along with its links in other nodes
std::vector< ops::InputOp * > getInputs() const
Returns all graph input nodes.
std::vector< ops::OutputOp * > getOutputs() const
Returns all graph output nodes.
void accept(IVisitor *visitor)
Operation * create(Args &&...args)
Interface for visitors Use in MIR component if you want to enforce to implement visits for all operat...
std::size_t getNumInputs() const
virtual Operation * copyWithInputs(const std::vector< Output * > &inputs)=0
void setId(std::size_t id)
std::vector< Operation * > getSortedNodes(Graph *graph)
Returns nodes of the graph sorted topologically.