lanking520 commented 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(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:
[email protected]


With regards,
Apache Git Services

Reply via email to