Last active
September 2, 2015 05:09
-
-
Save taisukeoe/f3e4c0f4382e964c0163 to your computer and use it in GitHub Desktop.
Row wise operations got weired
This file contains 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
scala> val ndArray = (1d to 8d by 1).mkNDArray(Array(2,2,2),NDOrdering.C) | |
ndArray: org.nd4j.linalg.api.ndarray.INDArray = | |
[[[1.00,2.00] | |
[3.00,4.00]] | |
[[5.00,6.00] | |
[7.00,8.00]]] | |
scala> ndArray.sliceP.map(s => s.rowP.map(r => r*r)) | |
res12: org.nd4j.linalg.api.ndarray.INDArray = | |
[[[1.00,2.00] | |
[9.00,16.00]] | |
[[5.00,6.00] | |
[49.00,64.00]]] | |
scala> ndArray.sliceP.map(s => s.columnP.map(r => r*r)) | |
res13: org.nd4j.linalg.api.ndarray.INDArray = | |
[[[1.00,4.00] | |
[9.00,16.00]] | |
[[25.00,36.00] | |
[49.00,64.00]]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment