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 2018/10/24 01:12:21 UTC

[GitHub] lanking520 edited a comment on issue #12690: [MXNET-1000] get Ndarray real value and form it from a NDArray

lanking520 edited a comment on issue #12690: [MXNET-1000] get Ndarray real value and form it from a NDArray
URL: https://github.com/apache/incubator-mxnet/pull/12690#issuecomment-432406518
 
 
   This is a demo for toString method:
   ```Scala
       val arrBuf = ArrayBuffer[Array[Float]]()
       for (i <- 0 until 20) arrBuf += Array(1.0f, 2.0f, 3.0f, 4.0f)
       val arr = Array(
         Array(
           arrBuf.toArray
         ),
         Array(
           arrBuf.toArray
         )
       )
       val nd = NDArray.toNDArray(arr)
       println(Visualize.toString(nd))
       println(nd)
   ```
   Here is the output
   ```
   [
    [
     [
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
     ]
    ]
    [
     [
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
      [1.0,2.0,3.0,4.0]
     ]
    ]
   ]
   <NDArray (2,1,20,4) cpu(0)>
   ```
   Here is what Gluon looks like:
   ```
   Out[23]: [[0. 1. 2. 3.]
                   [4. 5. 9. 7.]
                   [ 8. 9. 10. 11.]]
                  <NDArray 3x4 @cpu(0)>
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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