Merge pull request #25332 from lgeiger:monotonic-functions

PiperOrigin-RevId: 232071191
This commit is contained in:
TensorFlower Gardener 2019-02-01 18:24:36 -08:00
commit 9167d6d159

View File

@ -178,18 +178,14 @@ bool IsDiv(const NodeDef& node) { return node.op() == "Div"; }
bool IsElementWiseMonotonic(const NodeDef& node, bool* is_non_decreasing) {
static const gtl::FlatSet<string>* const kMonotonicNonDecreasingOps =
CHECK_NOTNULL((new gtl::FlatSet<string>{
"Asinh", "Atanh", "Ceil", "Elu", "Erf", "Exp", "Expm1",
"Floor", "Log", "Log1p", "Relu", "Relu", "Relu6", "Rint",
"Selu", "Sigmoid", "Sign", "Sinh", "Sqrt", "Tanh",
"Acosh", "Asin", "Asinh", "Atan", "Atanh", "Ceil",
"Elu", "Erf", "Exp", "Expm1", "Floor", "Log",
"Log1p", "Relu", "Relu6", "Rint", "Selu", "Sigmoid",
"Sign", "Sinh", "Softsign", "Softplus", "Sqrt", "Tanh",
}));
static const gtl::FlatSet<string>* const kMonotonicNonIncreasingOps =
CHECK_NOTNULL((new gtl::FlatSet<string>{
"Inv",
"Reciprocal",
"Erfc",
"Rsqrt",
"Neg",
}));
CHECK_NOTNULL((new gtl::FlatSet<string>{"Acos", "Erfc", "Inv", "Neg",
"Reciprocal", "Rsqrt"}));
if (kMonotonicNonDecreasingOps->count(node.op()) > 0) {
if (is_non_decreasing) {
*is_non_decreasing = true;