You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/07/01 08:23:06 UTC

[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

haojin2 commented on a change in pull request #15390: [Numpy  fix-doc]modify numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r298929843
 
 

 ##########
 File path: python/mxnet/ndarray/numpy/_op.py
 ##########
 @@ -28,31 +28,65 @@
 __all__ = ['zeros', 'ones', 'maximum', 'minimum', 'stack', 'arange', 'argmax',
            'add', 'subtract', 'multiply', 'divide', 'mod', 'power', 'concatenate',
            'clip', 'split', 'swapaxes', 'expand_dims', 'tile', 'linspace',
-           'sin', 'cos', 'sinh', 'cosh', 'log10', 'sqrt']
+           'sin', 'cos', 'sinh', 'cosh', 'log10', 'sqrt', 'ceil', 'log1p', 'tanh']
 
 
 @set_module('mxnet.ndarray.numpy')
 def zeros(shape, dtype=_np.float32, **kwargs):
     """Return a new array of given shape and type, filled with zeros.
-    This function currently only supports storing multi-dimensional data
-    in row-major (C-style).
 
     Parameters
     ----------
-    shape : int or tuple of int
-        The shape of the empty array.
-    dtype : str or numpy.dtype, optional
-        An optional value type. Default is `numpy.float32`. Note that this
-        behavior is different from NumPy's `ones` function where `float64`
-        is the default value, because `float32` is considered as the default
-        data type in deep learning.
+    shape : int , tuple of ints or list of ints
+        Shape of the new array, e.g., ``(2, 3)`` or ``2``.
+    dtype : data-type, optional
+        The desired data-type for the array, e.g., `numpy.int8`.  Default is
+        `numpy.float32`.
     ctx : Context, optional
         An optional device context (default is the current default context).
 
     Returns
     -------
     out : ndarray
-        Array of zeros with the given shape, dtype, and ctx.
+        Array of zeros with the given shape, dtype, and order.
+
+    Notes
+    -----
+    - Not support ndarray type
+    - Not support custom dtype
+
+    >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype
+    mxnet.base.MXNetError: Invalid Input.
+
+    See Also
+    --------
+    zeros_like : Return an array of zeros with shape and type of input.
+    ones : Return a new array setting values to one.
+
+    Examples
+    --------
+    >>> np.zeros(5)
+    array([0., 0., 0., 0., 0.])
+
+    >>> np.zeros((5,), dtype=int)
+    array([0, 0, 0, 0, 0])
+
+    >>> np.zeros((2, 1))
+    array([[0.],
+           [0.]])
+
+    >>> s = (2,2)
+    >>> np.zeros(s)
+    array([[0., 0.],
+           [0., 0.]])
+
+    if you install mxnet gpu version, you can use gpu.
 
 Review comment:
   This line is not needed.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services