This commit introduces fmt helper specialized for moco-tf.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
}
return os;
}
+
+#include "TFFormattedGraph.h"
+
+namespace moco
+{
+namespace tf
+{
+
+FormattedGraph fmt(loco::Graph *g)
+{
+ auto node_summary_builder = stdex::make_unique<TFNodeSummaryBuilderFactory>();
+ return std::move(locop::fmt<locop::LinearV1>(g).with(std::move(node_summary_builder)));
+}
+
+} // namespace tf
+} // namespace moco
#ifndef __LOG_HELPER_H__
#define __LOG_HELPER_H__
+#include <locop/FormattedGraph.h>
+
#include <loco/IR/FeatureShape.h>
#include <loco/IR/FilterShape.h>
#include <loco/IR/TensorShape.h>
*/
std::ostream &operator<<(std::ostream &os, const std::vector<int64_t> &vi64);
+namespace moco
+{
+namespace tf
+{
+
+using FormattedGraph = locop::FormattedGraphImpl<locop::Formatter::LinearV1>;
+
+FormattedGraph fmt(loco::Graph *g);
+
+static inline FormattedGraph fmt(const std::unique_ptr<loco::Graph> &g) { return fmt(g.get()); }
+
+} // namespace tf
+} // namespace moco
+
#endif // __LOG_HELPER_H__
*/
#include "Phase.h"
-
-#include "TFFormattedGraph.h"
+#include "LogHelper.h"
#include <moco/Log.h>
-#include <locop/FormattedGraph.h>
namespace
{
INFO(l) << "PhaseRunner<Saturate>";
INFO(l) << "Initial graph";
- INFO(l) << locop::fmt<locop::LinearV1>(_graph).with(
- stdex::make_unique<TFNodeSummaryBuilderFactory>());
+ INFO(l) << fmt(_graph);
for (bool changed = true; changed;)
{
}
INFO(l) << "After " << transform_name(tr.get()) << " (changed: " << to_char(chg_one) << ")";
- INFO(l) << locop::fmt<locop::LinearV1>(_graph).with(
- stdex::make_unique<TFNodeSummaryBuilderFactory>());
+ INFO(l) << fmt(_graph);
}
}
#include "ConstantFoldingTransform.h"
+#include "LogHelper.h"
#include "TestHelper.h"
#include "IR/TFFusedBatchNorm.h"
#include "Importer.h"
#include "Canonicalizer.h"
-#include "TFFormattedGraph.h"
#include <loco.h>
-#include <locop/FormattedGraph.h>
#include <moco/Log.h>
#include <plier/tf/TestHelper.h>
canonicalizer.canonicalize(graph.get());
INFO(l) << "Before ConstantFolding";
- INFO(l) << locop::fmt<locop::LinearV1>(graph).with(
- stdex::make_unique<moco::tf::TFNodeSummaryBuilderFactory>());
+ INFO(l) << moco::tf::fmt(graph);
moco::tf::ConstantFoldingTransform transform;
while (transform.run(graph.get()) == true)
}
INFO(l) << "After ConstantFolding ";
- INFO(l) << locop::fmt<locop::LinearV1>(graph).with(
- stdex::make_unique<moco::tf::TFNodeSummaryBuilderFactory>());
+ INFO(l) << moco::tf::fmt(graph);
auto push = moco::tf::test::find_first_node_bytype<loco::Push>(graph.get());
auto const_gen = dynamic_cast<loco::ConstGen *>(push->from());
canonicalizer.canonicalize(graph.get());
INFO(l) << "Before ConstantFolding";
- INFO(l) << locop::fmt<locop::LinearV1>(graph).with(
- stdex::make_unique<moco::tf::TFNodeSummaryBuilderFactory>());
+ INFO(l) << moco::tf::fmt(graph);
moco::tf::ConstantFoldingTransform transform;
while (transform.run(graph.get()) == true)
}
INFO(l) << "After ConstantFolding ";
- INFO(l) << locop::fmt<locop::LinearV1>(graph).with(
- stdex::make_unique<moco::tf::TFNodeSummaryBuilderFactory>());
+ INFO(l) << moco::tf::fmt(graph);
auto push = moco::tf::test::find_first_node_bytype<loco::Push>(graph.get());
auto const_gen = dynamic_cast<loco::ConstGen *>(push->from());
#include "ResolveFusedBatchNorm.h"
+#include "LogHelper.h"
#include "TestHelper.h"
#include "IR/TFFusedBatchNorm.h"
#include "Importer.h"
-#include "TFFormattedGraph.h"
#include <loco.h>
-#include <locop/FormattedGraph.h>
#include <moco/Log.h>
#include <stdex/Memory.h>
#include <plier/tf/TestHelper.h>
auto graph = importer.import(signature, graph_def);
INFO(l) << "Before ResolveFusedBatchNorm";
- INFO(l) << locop::fmt<locop::LinearV1>(graph).with(
- stdex::make_unique<moco::tf::TFNodeSummaryBuilderFactory>());
+ INFO(l) << moco::tf::fmt(graph);
moco::tf::ResolveFusedBatchNorm transform;
bool changed = transform.run(graph.get());
INFO(l) << "After ResolveFusedBatchNorm " << to_char(changed);
- INFO(l) << locop::fmt<locop::LinearV1>(graph).with(
- stdex::make_unique<moco::tf::TFNodeSummaryBuilderFactory>());
+ INFO(l) << moco::tf::fmt(graph);
// Output value test will be done with mocotest-tf
// Network structure of transformation is not important and may be changed