hzfan commented on a change in pull request #15388: Doc
URL: https://github.com/apache/incubator-mxnet/pull/15388#discussion_r298880809
 
 

 ##########
 File path: python/mxnet/ndarray/numpy/_op.py
 ##########
 @@ -720,6 +742,137 @@ def _unary_func_helper(x, fn_array, fn_scalar, out=None, 
**kwargs):
     else:
         raise TypeError('type {} not supported'.format(str(type(x))))
 
+@set_module('mxnet.ndarray.numpy')
+def trunc(x, out=None, **kwargs):
+    r"""
+    trunc(x, out=None)
+
+    Return the truncated value of the input, element-wise.
+
+    The truncated value of the scalar `x` is the nearest integer `i` which
+    is closer to zero than `x` is. In short, the fractional part of the
+    signed number `x` is discarded.
+    
+    Parameters
+    ----------
+    x : ndarray or scalar
+        Input data.
+    out : ndarray or None, optional 
+        A location into which the result is stored. 
+    
+    Returns
+    -------
+    y : ndarray or scalar
+        The truncated value of each element in `x`.
+        This is a scalar if `x` is a scalar.
+
+    Notes
+    -----
+    This function differs to the original numpy.trunc in the following aspects:
+        - Do not support 'where', a parameter in numpy which indicates where 
to calculate.
+        - Cannot cast type automatically. Dtype of 'out' must be same as the 
expected one.
+        - Cannot broadcast automatically. Shape of 'out' must be same as the 
expected one.
+        - If 'x' is plain python numeric, the result won't be stored in out.
 
 Review comment:
   \`x\`

----------------------------------------------------------------
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

Reply via email to