We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a06ed0 commit 3e138d5Copy full SHA for 3e138d5
ndarray/src/test/java/org/tensorflow/ndarray/IndexTest.java
@@ -48,10 +48,13 @@ public void testNullConversions(){
48
@Test
49
public void testIndices(){
50
51
- String[][] indexData = new String[5][4];
52
- for (int i=0 ; i < 5; i++)
+ // String[][] indexData = new String[5][4];
+ String[][] indexData = new String[5][];
53
+ for (int i=0 ; i < 5; i++){
54
+ indexData[i] = new String[4];
55
for (int j=0 ; j < 4; j++)
56
indexData[i][j] = "("+j+", "+i+")";
57
+ }
58
59
NdArray<String> matrix2d = StdArrays.ndCopyOf(indexData);
60
assertEquals(2, matrix2d.rank());
@@ -63,6 +66,7 @@ public void testIndices(){
63
66
|(0, 3), (1, 3), (2, 3), (3, 3)|
64
67
|(0, 4), (1, 4), (2, 4), (3, 4)|
65
68
*/
69
+ assertArrayEquals(new String[]{"(0, 0)", "(1, 0)", "(2, 0)", "(3, 0)"}, indexData[0]);
70
71
NdArray<String> same1 = matrix2d.slice(Indices.all());
72
String[][] same1j = StdArrays.array2dCopyOf(same1, String.class);
0 commit comments