Use `dumpGraph` function instead of `IrDotDumper` class.
Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
#define NNCC_DUMPERPASS_H
#include "pass/Pass.h"
-#include "pass/PassData.h"
-#include "mir/IrDotDumper.h"
namespace nnc
{
class DumperPass : public Pass
{
public:
- explicit DumperPass(std::string s) : _file_name(std::move(s)){};
+ explicit DumperPass(std::string s) : _file_name(std::move(s)) {}
PassData run(PassData data) override;
#include "passes/dot_dumper/DumperPass.h"
#include "mir/Graph.h"
-#include "pass/PassException.h"
+#include "mir/IrDotDumper.h"
#include <fstream>
PassData DumperPass::run(PassData data)
{
- auto g = static_cast<Graph *>(data);
- assert(g);
- IrDotDumper dotDumper;
- g->accept(&dotDumper);
- std::ofstream f_out;
- f_out.open(std::to_string(_counter) + "_" + _file_name + ".dot");
- dotDumper.writeDot(f_out);
- f_out.close();
-
- _counter++;
- return g;
+ auto graph = static_cast<Graph *>(data);
+ assert(graph && "graph object is expected");
+ std::ofstream stream(std::to_string(_counter++) + "_" + _file_name + ".dot");
+ dumpGraph(graph, stream);
+ return graph;
}
} // namespace nnc
using namespace nnc;
using namespace mir;
-using namespace nnc::cli;
int main(int argc, const char **argv)
{
try
{
- IrDotDumper dotDumper;
- auto g = static_cast<Graph *>(importer.importModel());
- g->accept(&dotDumper);
- dotDumper.writeDot(std::cout);
+ auto graph = static_cast<Graph *>(importer.importModel());
+ dumpGraph(graph, std::cout);
}
catch (PassException &e)
{
#include "support/CommandLine.h"
#include "option/Options.h"
#include "caffe_importer_pass.h"
-#include "mir/Graph.h"
#include "mir/IrDotDumper.h"
#include "pass/PassException.h"
using namespace nnc;
using namespace mir;
-using namespace nnc::cli;
int main(int argc, const char **argv)
{
try
{
- IrDotDumper dotDumper;
- auto g = importer.importModel();
- g->accept(&dotDumper);
- dotDumper.writeDot(std::cout);
+ auto graph = importer.importModel();
+ dumpGraph(graph, std::cout);
}
catch (PassException &e)
{