diff --git a/runtime/onert/core/src/exec/MinMaxRecorder.cc b/runtime/onert/core/src/exec/MinMaxRecorder.cc index 8c7402c07a7..17980001148 100644 --- a/runtime/onert/core/src/exec/MinMaxRecorder.cc +++ b/runtime/onert/core/src/exec/MinMaxRecorder.cc @@ -15,7 +15,11 @@ */ #include "MinMaxRecorder.h" - +#if MINMAX_H5DUMPER +#include "../dumper/h5/MinMaxDumper.h" +#else +#include "MinMaxData.h" +#endif #include "backend/ITensor.h" #include @@ -28,12 +32,9 @@ namespace exec MinMaxRecorder::MinMaxRecorder(const std::string &workspace_dir, const ir::Graph &graph, const backend::BackendContexts &backend_contexts) -#if MINMAX_H5DUMPER - : _graph{graph}, _backend_contexts{backend_contexts}, _h5dumper(workspace_dir + "/minmax.h5") -#else - : _graph{graph}, _backend_contexts{backend_contexts}, _raw_dumper(workspace_dir + "/minmax.bin") -#endif + : _graph{graph}, _backend_contexts{backend_contexts}, _workspace_dir(workspace_dir) { + // DO NOTHING } std::pair minmaxFrom(const backend::ITensor *tensor) @@ -148,9 +149,11 @@ void MinMaxRecorder::handleSubgraphEnd(ir::SubgraphIndex) // It would be better to dump at the end of model execution, not subgraph // But it requires more changes than subgraph. #if MINMAX_H5DUMPER - _h5dumper.dump(_input_minmax, _op_minmax); + auto h5dumper = dumper::h5::MinMaxDumper(_workspace_dir + "/minmax.h5"); + h5dumper.dump(_input_minmax, _op_minmax); #else - _raw_dumper.dump(_input_minmax, _op_minmax); + auto raw_dumper = RawMinMaxDumper(_workspace_dir + "/minmax.bin"); + raw_dumper.dump(_input_minmax, _op_minmax); #endif } diff --git a/runtime/onert/core/src/exec/MinMaxRecorder.h b/runtime/onert/core/src/exec/MinMaxRecorder.h index 1bece05f051..04173bfdc67 100644 --- a/runtime/onert/core/src/exec/MinMaxRecorder.h +++ b/runtime/onert/core/src/exec/MinMaxRecorder.h @@ -20,13 +20,8 @@ #include "ExecutionObservers.h" #include "ir/Index.h" #include "exec/MinMaxMap.h" -#if MINMAX_H5DUMPER -#include "../dumper/h5/MinMaxDumper.h" -#else -#include "MinMaxData.h" -#endif -#include +#include namespace onert { @@ -51,11 +46,7 @@ class MinMaxRecorder : public IExecutionObserver private: const ir::Graph &_graph; const backend::BackendContexts &_backend_contexts; -#if MINMAX_H5DUMPER - dumper::h5::MinMaxDumper _h5dumper; -#else - RawMinMaxDumper _raw_dumper; -#endif + std::string _workspace_dir; OpMinMaxMap _op_minmax; IOMinMaxMap _input_minmax; };