[tf2circle] setenv for knobs required for Instance Norm fusion (#9172)
author박천교/On-Device Lab(SR)/Engineer/삼성전자 <ch.bahk@samsung.com>
Mon, 25 Nov 2019 09:34:18 +0000 (18:34 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 25 Nov 2019 09:34:18 +0000 (18:34 +0900)
This commit sets environment variable turned on for following knobs
in tf2circle:
- EXO_UseFuseInstanceNormPass
- EXO_UseFuseSquaredDifferencePass

These knobs are required to fuse Instance Norm pattern.

Signed-off-by: Cheongyo Bahk <ch.bahk@samsung.com>
compiler/tf2circle/src/tf2circle.cpp

index 60a0699..415a1ae 100644 (file)
@@ -180,6 +180,12 @@ int EntryFunctor::operator()(int argc, char **argv) const
   INFO(l) << "Import Graph" << std::endl;
   INFO(l) << locop::fmt<locop::Formatter::LinearV1>(g) << std::endl;
 
+  // This is work-around for tf2circle to fuse Instance Norm, while for
+  // tf2tflite not to do so (nnkit-tflite version issue)
+  // TODO Find better way. This is only temporal work-around!
+  setenv("EXO_UseFuseInstanceNormPass", "1", /* overwrite */ false);
+  setenv("EXO_UseFuseSquaredDifferencePass", "1", /* overwrite */ false);
+
   std::cout << "Export into '" << circle_path << "'" << std::endl;
   exo::CircleExporter(g.get()).dumpToFile(circle_path.c_str());
   std::cout << "Export into '" << circle_path << "' - Done" << std::endl;