ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::dumper::text Namespace Reference

Functions

std::string formatOperandBrief (ir::OperandIndex ind)
 
std::string formatOperand (const ir::Graph &, ir::OperandIndex ind)
 
std::string formatOperation (const ir::IOperation &op, ir::OperationIndex ind)
 
std::string formatOperation (const ir::Graph &graph, ir::OperationIndex ind)
 
void dumpGraph (const ir::Graph &graph)
 
void dumpLoweredGraph (const compiler::LoweredGraph &lgraph)
 
void dumpLoweredGraph (const compiler::train::LoweredTrainableGraph &lgraph)
 

Function Documentation

◆ dumpGraph()

void onert::dumper::text::dumpGraph ( const ir::Graph graph)

Definition at line 79 of file GraphDumper.cc.

80{
81 VERBOSE(GraphDumper) << "{\n";
82 auto ops_topol = graph.topolSortOperations();
83 for (auto &&op_ind : ops_topol)
84 {
85 const auto &op = graph.operations().at(op_ind);
86 VERBOSE(GraphDumper) << " " << formatOperation(op, op_ind) << "\n";
87 }
88 graph.operands().iterate([&](const ir::OperandIndex &idx, const ir::Operand &oprd) {
89 VERBOSE(GraphDumper) << " Origin(" << idx << "): " << oprd.originIndex() << std::endl;
90 });
91 VERBOSE(GraphDumper) << "}\n";
92}
OriginIndex originIndex() const
Definition Operand.h:108
#define VERBOSE(name, lv)
Definition Log.h:71
std::string formatOperation(const ir::IOperation &op, ir::OperationIndex ind)

References formatOperation(), onert::ir::Operand::originIndex(), and VERBOSE.

Referenced by dumpLoweredGraph(), and dumpLoweredGraph().

◆ dumpLoweredGraph() [1/2]

void onert::dumper::text::dumpLoweredGraph ( const compiler::LoweredGraph lgraph)

Definition at line 94 of file GraphDumper.cc.

95{
96 // TODO Graph dump with backend info
97 dumpGraph(lgraph.graph());
98}
ir::Graph & graph() override

References dumpGraph(), and onert::compiler::LoweredGraph::graph().

◆ dumpLoweredGraph() [2/2]

void onert::dumper::text::dumpLoweredGraph ( const compiler::train::LoweredTrainableGraph lgraph)

Definition at line 100 of file GraphDumper.cc.

101{
102 // TODO Graph dump with backend info
103 dumpGraph(lgraph.graph());
104}

References dumpGraph(), and onert::compiler::train::LoweredTrainableGraph::graph().

◆ formatOperand()

std::string onert::dumper::text::formatOperand ( const ir::Graph ,
ir::OperandIndex  ind 
)

Definition at line 52 of file GraphDumper.cc.

53{
54 std::stringstream ss;
55 ss << ind;
56 // TODO Print shape, type and maybe more
57 return ss.str();
58}

◆ formatOperandBrief()

std::string onert::dumper::text::formatOperandBrief ( ir::OperandIndex  ind)

Definition at line 45 of file GraphDumper.cc.

46{
47 std::stringstream ss;
48 ss << ind;
49 return ss.str();
50}

◆ formatOperation() [1/2]

std::string onert::dumper::text::formatOperation ( const ir::Graph graph,
ir::OperationIndex  ind 
)

Definition at line 72 of file GraphDumper.cc.

73{
74 std::stringstream ss;
75 const auto &op = graph.operations().at(ind);
76 return formatOperation(op, ind);
77}

References formatOperation().

◆ formatOperation() [2/2]

std::string onert::dumper::text::formatOperation ( const ir::IOperation op,
ir::OperationIndex  ind 
)

Definition at line 60 of file GraphDumper.cc.

61{
62 std::stringstream ss;
63
64 ss << formatOperandIndexSequence(op.getOutputs());
65 ss << " = ";
66 ss << ind << "_" << op.name() << "(";
67 ss << formatOperandIndexSequence(op.getInputs());
68 ss << ")";
69 return ss.str();
70}
virtual const OperandIndexSequence & getInputs() const =0
virtual const OperandIndexSequence & getOutputs() const =0
virtual std::string name() const
Definition IOperation.h:38

References onert::ir::IOperation::getInputs(), onert::ir::IOperation::getOutputs(), and onert::ir::IOperation::name().

Referenced by onert::compiler::Linear::dump(), dumpGraph(), and formatOperation().