Commit ad2e0097 authored by Nick Korovaiko's avatar Nick Korovaiko Committed by Robert Kimball

disable/enable constant_folding (#1630)

parent 2d2b3b2f
......@@ -28,6 +28,13 @@ namespace ngraph
class ngraph::pass::ConstantFolding : public ngraph::pass::GraphRewrite
{
enum class CFTransformations
{
RESHAPE,
BROADCAST,
PAD
};
public:
ConstantFolding()
: GraphRewrite()
......@@ -37,6 +44,22 @@ public:
construct_constant_pad();
}
//this allows to specify the order in which matchers will be run
//and also allows to register the same matcher more than once
ConstantFolding(const std::vector<CFTransformations>& transformations)
: GraphRewrite()
{
for (auto cft : transformations)
{
switch (cft)
{
case CFTransformations::RESHAPE: construct_constant_reshape(); break;
case CFTransformations::BROADCAST: construct_constant_broadcast(); break;
case CFTransformations::PAD: construct_constant_pad(); break;
}
}
}
private:
void construct_constant_reshape();
void construct_constant_broadcast();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment