Created
January 12, 2017 08:21
-
-
Save Leammas/2944e4e36684c49c32b47143f6d06b1a to your computer and use it in GitHub Desktop.
NDArrayUtil.toNDArray shape issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.nd4j.linalg.util.NDArrayUtil | |
| val arr = Array(Array(0, 0), Array(0, 0), Array(0, 0)) | |
| println(s"width: ${arr.length}") // 3 | |
| println(s"height: ${arr(0).length}") // 2 | |
| val ndArr = NDArrayUtil.toNDArray(arr) | |
| println(s"width: ${ndArr.columns()}") // 3 | |
| println(s"height: ${ndArr.rows()}") // 1 | |
| println(ndArr.data().toString) // [0.0,0.0,0.0,0.0,0.0,0.0] | |
| println(ndArr.shapeInfoToString()) // [1, 3] | |
| println(ndArr.reshape(3, 1).shapeInfoToString()) // ok | |
| println(ndArr.reshape(1, 6).shapeInfoToString()) // this one throws java.lang.IllegalStateException: Mis matched lengths: [6] != [3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment