ONE - On-device Neural Engine
|
Pass to specially handle odd outputs in a subgraph. More...
#include <OddOutputPass.h>
Public Member Functions | |
std::string | id () final |
void | run () override |
Pass (ir::Graph &graph) | |
Public Member Functions inherited from onert::compiler::pass::Pass | |
Pass (ir::Graph &graph) | |
virtual | ~Pass ()=default |
Public Member Functions inherited from onert::compiler::pass::IPass | |
virtual | ~IPass ()=default |
Additional Inherited Members | |
Protected Attributes inherited from onert::compiler::pass::Pass | |
ir::Graph & | _graph |
Pass to specially handle odd outputs in a subgraph.
Runtime Graph IR requires every input or output must have distinct tensor index, this is onert's restriction. However we allow duplication of indices in the models(or API). So we should transform the graph after model-loading.
This is necessary since our API lets users to set different buffers for each input and output so it is unavoidable that we must copy the value at runtime.
Note that this is a mandatory pass for Graph.
Case 1 : An operand which is a model output and a model input
Create an operand and insert a Permute(copy) op between them. And change the output to be the newly generated operand.
e.g.)
Case 2 : Two or more duplicated outputs
Do the same with Case 1, but between two outputs of the same tensor index.
e.g.)
Definition at line 70 of file OddOutputPass.h.
|
inlinefinalvirtual |
Implements onert::compiler::pass::Pass.
Definition at line 76 of file OddOutputPass.h.
|
overridevirtual |
Implements onert::compiler::pass::Pass.
Definition at line 30 of file OddOutputPass.cc.
References onert::compiler::pass::Pass::_graph, onert::util::ObjectManager< Index, Object >::at(), onert::ir::OperandIndexSequence::contains(), onert::ir::Graph::getInputs(), onert::ir::Graph::getOutputs(), onert::ir::Graph::operands(), onert::ir::OperandIndexSequence::replace(), and VERBOSE.
Referenced by package.infer.session::inference().