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/05/10 23:41:30 UTC

[GitHub] [incubator-mxnet] ChaiBapchya commented on a change in pull request #14243: Fix commands to make doc consistent

ChaiBapchya commented on a change in pull request #14243: Fix commands to make doc consistent
URL: https://github.com/apache/incubator-mxnet/pull/14243#discussion_r283069953
 
 

 ##########
 File path: python/mxnet/ndarray_doc.py
 ##########
 @@ -54,6 +55,274 @@ class ReshapeDoc(NDArrayDoc):
     (4L, 3L, 2L)
     """
 
+class ConcatDoc(NDArrayDoc):
+    """
+    Examples
+    --------
+
+    Joins input arrays along a given axis.
+
+    >>> x = mx.nd.array([[1,1],[2,2]])
+    >>> y = mx.nd.array([[3,3],[4,4],[5,5]])
+    >>> z = mx.nd.array([[6,6], [7,7],[8,8]])
+
+    >>> mx.nd.concat(x,y,z,dim=0)
+    [[1. 1.]
+    [2. 2.]
+    [3. 3.]
+    [4. 4.]
+    [5. 5.]
+    [6. 6.]
+    [7. 7.]
+    [8. 8.]]
+    <NDArray 8x2 @cpu(0)>
+
+    >>> mx.nd.concat(y,z,dim=1)
+    [[3. 3. 6. 6.]
+    [4. 4. 7. 7.]
+    [5. 5. 8. 8.]]
+    <NDArray 3x4 @cpu(0)>
+    """
+
+class SwapAxisDoc(NDArrayDoc):
+    """
+    Examples
+    --------
+
+    Interchanges two axes of an array.
+
+    >>> x = mx.nd.array([[1, 2, 3]])
+    >>> mx.nd.swapaxes(x, 0, 1)
+    [[1.]
+    [2.]
+    [3.]]
+
+    >>> x = mx.nd.array([[[ 0, 1],[ 2, 3]],[[ 4, 5],[ 6, 7]]])
+    >>> x
+    [[[0. 1.]
+      [2. 3.]]
+    [[4. 5.]
+      [6. 7.]]]
+    <NDArray 2x2x2 @cpu(0)>
+    >>> mx.nd.swapaxes(x, 0, 2)
+    [[[0. 4.]
+     [2. 6.]]
+    [[1. 5.]
+      [3. 7.]]]
+    <NDArray 2x2x2 @cpu(0)>
+    """
+
+class whereDoc(NDArrayDoc):
+    """
+    Examples
+    --------
+
+    Return the elements, either from x or y, depending on the condition.
+
+    >>> x = mx.nd.array([[1, 2], [3, 4]])
+    >>> y = mx.nd.array([[5, 6], [7, 8]])
+
+    >>> cond = mx.nd.array([[0, 1], [-1, 0]])
+    >>> mx.nd.where(cond, x, y)
+    [[5. 2.]
+    [3. 8.]]
+    <NDArray 2x2 @cpu(0)>
+
+    >>> csr_cond = mx.nd.sparse.cast_storage(cond, 'csr')
+    >>> mx.nd.sparse.where(csr_cond, x, y)
+    [[5. 2.]
+    [3. 8.]]
+    <NDArray 2x2 @cpu(0)>
+    """
+
+class ReshapeLikeDoc(NDArrayDoc):
+    """
+    Reshape some or all dimensions of `lhs` to have the same shape as some or all dimensions of `rhs`.
+    Example
+    -------
+
+    >>> x = mx.nd.array([1, 2, 3, 4, 5, 6])
+    >>> y = mx.nd.array([[0, -4], [3, 2], [2, 2]])
+    >>> mx.nd.reshape_like(x, y)
+    [[1. 2.]
+    [3. 4.]
+    [5. 6.]]
+    <NDArray 3x2 @cpu(0)>
+    """
+
+class shape_arrayDoc(NDArrayDoc):
+    """
+    Returns a 1D int64 array containing the shape of data.
+    Example
+    -------
+
+    >>> x = mx.nd.array([[1,2,3,4], [5,6,7,8]])
+    >>> mx.nd.shape_array(x)
+    [2 4]
+    <NDArray 2 @cpu(0)>
+    """
+
+class size_arrayDoc(NDArrayDoc):
+    """
+    Returns a 1D int64 array containing the size of data.
+    Example
+    -------
+
+    >>> x = mx.nd.array([[1,2,3,4], [5,6,7,8]])
+    >>> mx.nd.size_array(x)
+    [8]
+    <NDArray 1 @cpu(0)>
+    """
+
+class CastDoc(NDArrayDoc):
 
 Review comment:
   Absolutely no idea why.

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