ONE - On-device Neural Engine
|
#include <Graph.h>
Public Member Functions | |
Graph (void) | |
Graph (const Graph &) | |
~Graph (void) | |
OperandIndex | addOperand (const Shape &shape, const TypeInfo &type) |
OperandIndex | addOperand (OperandIndex index, std::unique_ptr< Operand > &&operand) |
Add an operand to the graph with the given index and object. | |
OperationIndex | addOperation (std::unique_ptr< IOperation > &&node) |
OperationIndex | addOperation (OperationIndex index, std::unique_ptr< IOperation > &&operation) |
Add an operation to the graph with the given index and object. | |
OperationIndex | replaceOperation (OperationIndex index, std::unique_ptr< IOperation > &&operation) |
Replace an operation which the graph already has. | |
void | setOperandValue (const OperandIndex &ind, std::shared_ptr< Data > data) |
void | changeShape (const OperandIndex &ind, const ir::Shape &new_shape) override |
void | addInput (const OperandIndex &ind, const std::string &name="") |
void | addOutput (const OperandIndex &ind, const std::string &name="") |
void | verify (void) const |
void | removeOperand (const OperandIndex &ind) |
const OperandIndexSequence & | getInputs () const override |
OperandIndexSequence & | getInputs () |
const OperandIndexSequence & | getOutputs () const override |
OperandIndexSequence & | getOutputs () |
IOIndex | getInputIndex (const std::string &name) const override |
IOIndex | getOutputIndex (const std::string &name) const override |
const Operands & | operands () const override |
Operands & | operands () |
const Operations & | operations () const override |
Operations & | operations () |
std::vector< ir::OperationIndex > | topolSortOperations () const |
Public Member Functions inherited from onert::ir::IGraph | |
virtual | ~IGraph ()=default |
|
explicitdefault |
|
explicitdefault |
|
default |
void onert::ir::Graph::addInput | ( | const OperandIndex & | ind, |
const std::string & | name = "" |
||
) |
Definition at line 123 of file Graph.cc.
References onert::ir::OperandIndexSequence::append(), and onert::ir::OperandIndexSequence::size().
Referenced by onert::ir::train::TrainableGraph::addInput().
OperandIndex onert::ir::Graph::addOperand | ( | const Shape & | shape, |
const TypeInfo & | type | ||
) |
Definition at line 35 of file Graph.cc.
References onert::util::ObjectManager< Index, Object >::emplace().
Referenced by onert::ir::train::TrainableGraph::addOperand(), onert::ir::train::TrainableGraph::addOperand(), onert::compiler::pass::ConstantOutputPass::callback(), and onert::loader::BaseLoader< LoaderDomain >::loadOperand().
OperandIndex onert::ir::Graph::addOperand | ( | OperandIndex | index, |
std::unique_ptr< Operand > && | operand | ||
) |
Add an operand to the graph with the given index and object.
If the given index is available, it succeeds. And operand
is moved which invalidates the caller's pointer. If the given index is already taken, it fails. And operand
will not be moved so the caller's pointer will be still valid.
[in] | index | Index to be added |
[in] | operand | Operand to be added |
index
if successful, Undefined otherwise Definition at line 40 of file Graph.cc.
References onert::util::ObjectManager< Index, Object >::push().
OperationIndex onert::ir::Graph::addOperation | ( | OperationIndex | index, |
std::unique_ptr< IOperation > && | operation | ||
) |
Add an operation to the graph with the given index and object.
If the given index is available, it succeeds. And operation
is moved which invalidates the caller's pointer. If the given index is already taken, it fails. And operation
will not be moved so the caller's pointer will be still valid.
index | Index to be added |
operation | IOperation to be added |
index
if successful, Undefined otherwise Definition at line 80 of file Graph.cc.
References onert::util::ObjectManager< Index, Object >::push().
OperationIndex onert::ir::Graph::addOperation | ( | std::unique_ptr< IOperation > && | node | ) |
Definition at line 69 of file Graph.cc.
References onert::util::ObjectManager< Index, Object >::push().
Referenced by onert::ir::train::TrainableGraph::addOperation().
void onert::ir::Graph::addOutput | ( | const OperandIndex & | ind, |
const std::string & | name = "" |
||
) |
Definition at line 130 of file Graph.cc.
References onert::ir::OperandIndexSequence::append(), and onert::ir::OperandIndexSequence::size().
Referenced by onert::ir::train::TrainableGraph::addOutput().
|
overridevirtual |
Implements onert::ir::IGraph.
Definition at line 117 of file Graph.cc.
References onert::util::ObjectManager< Index, Object >::at(), and onert::util::ObjectManager< Index, Object >::exist().
Referenced by onert::ir::train::TrainableGraph::changeShape().
|
overridevirtual |
Implements onert::ir::IGraph.
Definition at line 137 of file Graph.cc.
Referenced by onert::ir::train::TrainableGraph::getInputIndex().
|
inline |
|
inlineoverridevirtual |
Implements onert::ir::IGraph.
Definition at line 106 of file Graph.h.
Referenced by onert::exec::ExecutorBase::execute(), onert::exec::ExecutorBase::ExecutorBase(), onert::ir::train::TrainableGraph::getInputs(), onert::exec::MinMaxRecorder::handleSubgraphBegin(), onert::compiler::pass::UnusedOperandEliminationPass::run(), onert::compiler::pass::OddOutputPass::run(), and onert::backend::acl_common::AclSubTensorAnalyzer::visit().
|
overridevirtual |
Implements onert::ir::IGraph.
Definition at line 143 of file Graph.cc.
Referenced by onert::ir::train::TrainableGraph::getOutputIndex().
|
inline |
|
inlineoverridevirtual |
Implements onert::ir::IGraph.
Definition at line 108 of file Graph.h.
Referenced by onert::compiler::pass::ConstantOutputPass::callback(), onert::exec::ExecutorBase::execute(), onert::exec::ExecutorBase::ExecutorBase(), onert::ir::train::TrainableGraph::getOutputs(), onert::compiler::pass::UnusedOperandEliminationPass::run(), and onert::compiler::pass::OddOutputPass::run().
|
inline |
|
inlineoverridevirtual |
Implements onert::ir::IGraph.
Definition at line 112 of file Graph.h.
Referenced by onert::compiler::pass::ConstantOutputPass::callback(), onert::compiler::pass::PermutationInsertionPass::callback(), onert::compiler::pass::ConstantInsertionPass::callback(), onert::compiler::pass::ConstantLoweringPass::callback(), onert::compiler::train::pass::TrainableConstantInsertionPass::callback(), onert::compiler::StaticShapeInferer::dump(), onert::backend::acl_common::AclBackendContext< T_TensorBuilder, T_ConstantInitializer, T_KernelGenerator, T_Optimizer >::genTensors(), onert::exec::ProfileObserver::handleJobEnd(), onert::backend::cl_common::BackendContext< T_TensorBuilder, T_ConstantInitializer, T_KernelGenerator >::initConsts(), onert::backend::basic::initConsts(), onert::loader::BaseLoader< LoaderDomain >::loadOperand(), onert::ir::train::TrainableGraph::operands(), onert::ir::train::TrainableGraph::operands(), onert::backend::cl_common::BackendContext< T_TensorBuilder, T_ConstantInitializer, T_KernelGenerator >::planTensors(), onert::compiler::pass::UnusedOperandEliminationPass::run(), onert::compiler::pass::OddOutputPass::run(), onert::compiler::pass::OperandPass::run(), topolSortOperations(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::backend::acl_common::AclSubTensorAnalyzer::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), onert::compiler::ShapeValidator::visit(), and onert::compiler::ShapeValidator::visit().
|
inline |
|
inlineoverridevirtual |
Implements onert::ir::IGraph.
Definition at line 114 of file Graph.h.
Referenced by onert::exec::DataflowExecutor::calculateRank(), onert::compiler::pass::ConstantOutputPass::callback(), onert::compiler::pass::PermutationInsertionPass::callback(), onert::ir::train::TrainableGraph::disableBackward(), onert::ir::train::TrainableGraph::enableBackward(), onert::backend::acl_cl::KernelGenerator::generate(), onert::backend::acl_neon::KernelGenerator::generate(), onert::backend::ruy::KernelGenerator::generate(), onert::backend::builtin::KernelGenerator::generate(), onert::backend::trix::KernelGenerator::generate(), onert::exec::TracingObserver::handleJobBegin(), onert::exec::ProfileObserver::handleJobEnd(), onert::exec::TracingObserver::handleJobEnd(), onert::exec::MinMaxRecorder::handleJobEnd(), onert::compiler::StaticShapeInferer::infer(), onert::ir::train::TrainableGraph::operation(), onert::ir::train::TrainableGraph::operations(), onert::compiler::ShapeValidator::operator()(), onert::backend::acl_cl::Optimizer::optimize(), onert::backend::acl_neon::Optimizer::optimize(), onert::backend::cl_common::BackendContext< T_TensorBuilder, T_ConstantInitializer, T_KernelGenerator >::planTensors(), onert::compiler::pass::OperationPass::run(), onert::compiler::pass::UnusedOperandEliminationPass::run(), onert::compiler::HEScheduler::schedule(), and topolSortOperations().
|
inline |
Definition at line 94 of file Graph.h.
References onert::util::ObjectManager< Index, Object >::remove().
Referenced by onert::ir::train::TrainableGraph::removeOperand().
OperationIndex onert::ir::Graph::replaceOperation | ( | OperationIndex | index, |
std::unique_ptr< IOperation > && | operation | ||
) |
Replace an operation which the graph already has.
If the given index
is available, it succeeds. And operation
is moved which invalidates the caller's pointer. If the given operation
has at least one invalid operand index, it fails. And operation
will not be moved so the caller's pointer will be still valid.
No information in the graph is changed except for replacing an operation.
operation | Operation to be added |
index
if successful, UNDEFINED otherwise Definition at line 94 of file Graph.cc.
References onert::util::ObjectManager< Index, Object >::at(), onert::util::ObjectManager< Index, Object >::exist(), onert::ir::IOperation::getInputs(), onert::ir::IOperation::getOutputs(), and onert::util::ObjectManager< Index, Object >::set().
Referenced by onert::ir::train::TrainableGraph::replaceOperation().
void onert::ir::Graph::setOperandValue | ( | const OperandIndex & | ind, |
std::shared_ptr< Data > | data | ||
) |
Definition at line 111 of file Graph.cc.
References onert::util::ObjectManager< Index, Object >::at(), and onert::util::ObjectManager< Index, Object >::exist().
Referenced by onert::loader::BaseLoader< LoaderDomain >::loadOperand().
std::vector< ir::OperationIndex > onert::ir::Graph::topolSortOperations | ( | ) | const |
Definition at line 184 of file Graph.cc.
References onert::util::Set< Element >::add(), onert::util::ObjectManager< Index, Object >::at(), onert::util::Set< Element >::contains(), onert::ir::DUPLICATED, onert::util::Set< Element >::empty(), onert::util::ObjectManager< Index, Object >::iterate(), operands(), operations(), onert::util::Set< Element >::remove(), and onert::ir::UNDEFINED.
Referenced by onert::compiler::StaticShapeInferer::infer(), onert::compiler::train::StaticBackwardShapeInferer::infer(), onert::compiler::Linear::linearize(), and onert::ir::train::TrainableGraph::topolSortOperations().
void onert::ir::Graph::verify | ( | void | ) | const |
Definition at line 149 of file Graph.cc.
References verify().
Referenced by onert::ir::train::TrainableGraph::updateGraphDependency(), onert::ir::train::TrainableGraph::verify(), and verify().