#include "ir/Graph.h"
#include "compiler/LoweredGraph.h"
+#ifdef ONERT_TRAIN
+#include "compiler/train/LoweredTrainableGraph.h"
+#endif // ONERT_TRAIN
#include "util/logging.h"
#include "misc/string_helpers.h"
std::string formatOperandIndexSequence(const ir::OperandIndexSequence &seq)
{
std::vector<std::string> strs;
- for (auto ind : seq)
+ for (auto &&ind : seq)
strs.push_back(dumper::text::formatOperandBrief(ind));
return nnfw::misc::join(strs.begin(), strs.end(), ", ");
}
return ss.str();
}
-std::string formatOperation(const ir::Graph &graph, ir::OperationIndex ind)
+std::string formatOperation(const ir::IOperation &op, ir::OperationIndex ind)
{
std::stringstream ss;
- const auto &op = graph.operations().at(ind);
ss << formatOperandIndexSequence(op.getOutputs());
ss << " = ";
return ss.str();
}
+std::string formatOperation(const ir::Graph &graph, ir::OperationIndex ind)
+{
+ std::stringstream ss;
+ const auto &op = graph.operations().at(ind);
+ return formatOperation(op, ind);
+}
+
void dumpGraph(const ir::Graph &graph)
{
VERBOSE(GraphDumper) << "{\n";
auto ops_topol = graph.topolSortOperations();
- for (auto op_ind : ops_topol)
+ for (auto &&op_ind : ops_topol)
{
- VERBOSE(GraphDumper) << " " << formatOperation(graph, op_ind) << "\n";
+ const auto &op = graph.operations().at(op_ind);
+ VERBOSE(GraphDumper) << " " << formatOperation(op, op_ind) << "\n";
}
VERBOSE(GraphDumper) << "}\n";
VERBOSE(GraphDumper) << std::endl;
dumpGraph(lgraph.graph());
}
+#ifdef ONERT_TRAIN
+void dumpLoweredGraph(const compiler::train::LoweredTrainableGraph &lgraph)
+{
+ // TODO Graph dump with backend info
+ dumpGraph(lgraph.graph());
+}
+#endif // ONERT_TRAIN
+
} // namespace text
} // namespace dumper
} // namespace onert