From 8432dd2b8e92143438ca13a36710acea57d6771f Mon Sep 17 00:00:00 2001 From: Hao Jin Date: Sun, 7 Apr 2019 23:56:32 +0000 Subject: [PATCH] deprecate sym.pow, get rid of nd.pow --- python/mxnet/ndarray/ndarray.py | 58 +-------------------------------- python/mxnet/symbol/symbol.py | 2 ++ 2 files changed, 3 insertions(+), 57 deletions(-) diff --git a/python/mxnet/ndarray/ndarray.py b/python/mxnet/ndarray/ndarray.py index 5c2134722d7a..87f2712d8a40 100644 --- a/python/mxnet/ndarray/ndarray.py +++ b/python/mxnet/ndarray/ndarray.py @@ -46,7 +46,7 @@ "ones", "add", "arange", "eye", "divide", "equal", "full", "greater", "greater_equal", "imdecode", "lesser", "lesser_equal", "logical_and", "logical_or", "logical_xor", "maximum", "minimum", "moveaxis", "modulo", "multiply", "not_equal", "onehot_encode", - "pow", "power", "subtract", "true_divide", "waitall", "_new_empty_handle", "histogram", + "power", "subtract", "true_divide", "waitall", "_new_empty_handle", "histogram", "split_v2", "to_dlpack_for_read", "to_dlpack_for_write", "from_dlpack"] _STORAGE_TYPE_UNDEFINED = -1 @@ -3018,62 +3018,6 @@ def power(base, exp): # pylint: enable= no-member, protected-access -# pylint: disable=no-member -# pylint: disable=redefined-builtin -def pow(base, exp): - """Returns result of first array elements raised to powers from second array, element-wise - with broadcasting. - - Equivalent to ``base ** exp`` and ``mx.nd.broadcast_power(lhs, rhs)``. - - .. note:: - - If the corresponding dimensions of two arrays have the same size or one of them has size 1, - then the arrays are broadcastable to a common shape. - - Parameters - ---------- - base : scalar or NDArray - The base array - exp : scalar or NDArray - The exponent array. If ``base.shape != exp.shape``, they must be - broadcastable to a common shape. - - Returns - -------- - NDArray - The bases in x raised to the exponents in y. - - Examples - -------- - >>> x = mx.nd.ones((2,3))*2 - >>> y = mx.nd.arange(1,3).reshape((2,1)) - >>> z = mx.nd.arange(1,3).reshape((2,1)) - >>> x.asnumpy() - array([[ 2., 2., 2.], - [ 2., 2., 2.]], dtype=float32) - >>> y.asnumpy() - array([[ 1.], - [ 2.]], dtype=float32) - >>> z.asnumpy() - array([[ 1.], - [ 2.]], dtype=float32) - >>> (x**2).asnumpy() - array([[ 4., 4., 4.], - [ 4., 4., 4.]], dtype=float32) - >>> (x**y).asnumpy() - array([[ 2., 2., 2.], - [ 4., 4., 4.]], dtype=float32) - >>> mx.nd.pow(x,y).asnumpy() - array([[ 2., 2., 2.], - [ 4., 4., 4.]], dtype=float32) - >>> (z**y).asnumpy() - array([[ 1.], - [ 4.]], dtype=float32) - """ - power(base, exp) - - def maximum(lhs, rhs): """Returns element-wise maximum of the input arrays with broadcasting. diff --git a/python/mxnet/symbol/symbol.py b/python/mxnet/symbol/symbol.py index 457a3ef23b7b..91d4ca16df07 100644 --- a/python/mxnet/symbol/symbol.py +++ b/python/mxnet/symbol/symbol.py @@ -2740,6 +2740,8 @@ def pow(base, exp): Both inputs can be Symbol or scalar number. Broadcasting is not supported. Use `broadcast_pow` instead. + `sym.pow` is being deprecated, please use `sym.power` instead. + Parameters --------- base : Symbol or scalar