[moco-tf] Knob for ResolveReshapeWildcardDim (#6436)
author박천교/On-Device Lab(SR)/Engineer/삼성전자 <ch.bahk@samsung.com>
Fri, 9 Aug 2019 05:06:59 +0000 (14:06 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 9 Aug 2019 05:06:59 +0000 (14:06 +0900)
This commit introduces knob for ResolveReshapeWildcardDim. Default
behavior is 'on'

Signed-off-by: Cheongyo Bahk <ch.bahk@samsung.com>
compiler/moco-tf/src/Knob.lst
compiler/moco-tf/src/TFOptimizer.cpp

index 2cda2e6..b9169a3 100644 (file)
@@ -18,6 +18,7 @@ KNOB_BOOL(ImportAsTFRelu6, true, Import Relu6 node as TFRelu6 node)
 // TensorFlow dialect transforms
 KNOB_BOOL(FuseBinaryIntoPreceding, true, Fuse Binary node to preceding node)
 KNOB_BOOL(ResolveFusedBatchNorm, true, Enable ResolveFusedBatchNorm transform)
+KNOB_BOOL(ResolveReshapeWildcardDim, true, Resolve wildcard dimension in TFReshape node)
 
 // Canonicalization
 KNOB_BOOL(CanonicalizeBiasAdd, true, Enable Canonicalize for BiasAdd node)
index d295756..b704e14 100644 (file)
@@ -40,11 +40,14 @@ void TFOptimizer::optimize(loco::Graph *g) const
   {
     phase.emplace_back(stdex::make_unique<moco::tf::FuseBinaryIntoPreceding>());
   }
+  if (moco::tf::get<moco::tf::Knob::ResolveReshapeWildcardDim>())
+  {
+    phase.emplace_back(stdex::make_unique<moco::tf::ResolveReshapeWildcardDim>());
+  }
   // Fix shape and pad for added nodes doing above transformations
   // TODO need to merge or remove the ones in importer
   phase.emplace_back(stdex::make_unique<moco::tf::FixShapeTransform>());
   phase.emplace_back(stdex::make_unique<moco::tf::ResolveConstantShape>());
-  phase.emplace_back(stdex::make_unique<moco::tf::ResolveReshapeWildcardDim>());
   /* TRANSFORM DECLARATION END */
 
   moco::tf::PhaseRunner<moco::tf::PhaseStrategy::Saturate> phase_runner{g};