diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-06-16 08:53:17 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-06-16 08:56:40 -0700 |
commit | 5764747347c5a7b3e868ecc8943a397e304a0a92 (patch) | |
tree | 2f3be95ed6f81127c91545b40c478775318900ed /tensorflow/core/grappler/op_types.cc | |
parent | 1c697bc9094365cf5dab1ec1550eba019dffa3b8 (diff) |
Optimize max/min reductions over monotonic functions
PiperOrigin-RevId: 200843761
Diffstat (limited to 'tensorflow/core/grappler/op_types.cc')
-rw-r--r-- | tensorflow/core/grappler/op_types.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tensorflow/core/grappler/op_types.cc b/tensorflow/core/grappler/op_types.cc index 2227904dbf..b4ddd61c29 100644 --- a/tensorflow/core/grappler/op_types.cc +++ b/tensorflow/core/grappler/op_types.cc @@ -135,6 +135,18 @@ bool IsDequeueOp(const NodeDef& node) { bool IsDiv(const NodeDef& node) { return node.op() == "Div"; } +bool IsElementWiseMonotonic(const NodeDef& node) { + static const std::unordered_set<string>* element_wise_monotonic_ops = + CHECK_NOTNULL((new std::unordered_set<string>{ + "Relu", + "Relu6", + "Sigmoid", + "Sqrt", + "Tanh", + })); + return element_wise_monotonic_ops->count(node.op()) > 0; +} + bool IsEluGrad(const NodeDef& node) { return node.op() == "EluGrad"; } bool IsEnter(const NodeDef& node) { |