This commit adds constant folding into optimizer and turns the Knob ON.
Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
KNOB_BOOL(CanonicalizeConv2D, true, Enable Canonicalize for Conv2D node)
// Canonical transforms
+KNOB_BOOL(ConstantFolding, true, Enable constant-folding optimization)
KNOB_BOOL(RemoveForwardNode, true, Enable RemoveForwardNode optimization)
KNOB_BOOL(ReorderDecode, true, Enable ReorderDecode optimization)
// BEG: These knobs are valid only when ReorderDecode is enabled
moco::tf::Phase phase;
/* TRANSFORM DECLARATION BEGIN */
+ if (moco::tf::get<moco::tf::Knob::ConstantFolding>())
+ {
+ phase.emplace_back(stdex::make_unique<ConstantFoldingTransform>());
+ }
+
if (moco::tf::get<moco::tf::Knob::RemoveDeadNode>())
{
phase.emplace_back(stdex::make_unique<RemoveDeadNodeTransform>());