aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark Daoust <markdaoust@google.com>2017-07-11 14:26:30 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-07-11 14:34:21 -0700
commitcbe1ef05fff2d4fbd0ecc8f3a2c3a3a0f0dc312d (patch)
treed0a45adf353da66f67595eda62c225fd02bb503b
parentad7fb4d11c8689b04e6fb37ef02af60d8f94b2b5 (diff)
Add missing deprecation warnings.
Fixes #11422 PiperOrigin-RevId: 161581508
-rw-r--r--tensorflow/python/ops/math_ops.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/tensorflow/python/ops/math_ops.py b/tensorflow/python/ops/math_ops.py
index 7edd1c47d2..42839c2b94 100644
--- a/tensorflow/python/ops/math_ops.py
+++ b/tensorflow/python/ops/math_ops.py
@@ -168,13 +168,27 @@ from tensorflow.python.ops.gen_math_ops import *
# pylint: enable=wildcard-import
from tensorflow.python.util import compat
from tensorflow.python.util.deprecation import deprecated
+from tensorflow.python.util.deprecation import deprecated_args
# Aliases for some automatically-generated names.
linspace = gen_math_ops.lin_space
+arg_max = deprecated(None, "Use `argmax` instead")(arg_max) # pylint: disable=used-before-assignment
+arg_min = deprecated(None, "Use `argmin` instead")(arg_min) # pylint: disable=used-before-assignment
+
+
+def _set_doc(doc):
+ def _decorator(func):
+ func.__doc__ = doc
+ return func
+ return _decorator
+
# pylint: disable=redefined-builtin
-# TODO(aselle): deprecate arg_max
+@deprecated_args(None, "Use the `axis` argument instead", "dimension")
+@_set_doc(gen_math_ops.arg_max.__doc__
+ .replace("dimensions", "axes")
+ .replace("dimension", "axis"))
def argmax(input,
axis=None,
name=None,
@@ -189,12 +203,10 @@ def argmax(input,
return gen_math_ops.arg_max(input, axis, name=name, output_type=output_type)
-argmax.__doc__ = (gen_math_ops.arg_max.__doc__.replace("dimensions",
- "axes").replace(
- "dimension", "axis"))
-
-
-# TODO(aselle:deprecate arg_min)
+@deprecated_args(None, "Use the `axis` argument instead", "dimension")
+@_set_doc(gen_math_ops.arg_min.__doc__
+ .replace("dimensions", "axes")
+ .replace("dimension", "axis"))
def argmin(input,
axis=None,
name=None,
@@ -209,10 +221,6 @@ def argmin(input,
return gen_math_ops.arg_min(input, axis, name=name, output_type=output_type)
-argmin.__doc__ = (gen_math_ops.arg_min.__doc__.replace("dimensions",
- "axes").replace(
- "dimension", "axis"))
-
# pylint: enable=redefined-builtin