reminisce commented on a change in pull request #15377: [numpy][doc-fix]
zeros_like, linspace, reciprocal, square, and arcsin
URL: https://github.com/apache/incubator-mxnet/pull/15377#discussion_r298006239
##########
File path: python/mxnet/ndarray/numpy/_op.py
##########
@@ -882,3 +925,168 @@ def sqrt(x, out=None, **kwargs):
This function only supports input type of float.
"""
return _unary_func_helper(x, _npi.sqrt, _np.sqrt, out=out, **kwargs)
+
+
+@set_module('mxnet.ndarray.numpy')
+def reciprocal(x, out=None, **kwargs):
+ """
+ reciprocal(x, out=None, dtype=None)
+
+ Return the reciprocal of the argument, element-wise.
+ Calculates ``1/x``.
+
+ Parameters
+ ----------
+ x : ndarray
+ out : ndarray, None, or tuple of ndarray and None, optional
+ A location into which the result is stored. If provided, it must have
+ a shape that the inputs broadcast to. If not provided or None,
+ a freshly-allocated array is returned. A tuple
+ (possible only as a keyword argument) must have length equal to
+ the number of outputs.
+
+ Returns
+ -------
+ y : ndarray
+ Return array.
+
+
+ Examples
+ --------
+ >>> np.reciprocal(2.)
+ 0.5
+ >>> np.reciprocal([1, 2., 3.33])
+ array([ 1. , 0.5 , 0.3003003])
+
+ Notes
+ -----
+
+ .. note::
+ This function is not designed to work with integers.
+ For integer arguments with absolute value larger than 1 the result is
+ always zero because of the way Python handles integer division. For
+ integer zero the result is an overflow.
+
+ `ctx` argument is not supported now.
Review comment:
No need to add this line.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services