Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

Commit 3e138d5

Browse files
committed
Test Java copyFrom - trying to replicate Scala error v2
1 parent 0a06ed0 commit 3e138d5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ndarray/src/test/java/org/tensorflow/ndarray/IndexTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ public void testNullConversions(){
4848
@Test
4949
public void testIndices(){
5050

51-
String[][] indexData = new String[5][4];
52-
for (int i=0 ; i < 5; i++)
51+
// String[][] indexData = new String[5][4];
52+
String[][] indexData = new String[5][];
53+
for (int i=0 ; i < 5; i++){
54+
indexData[i] = new String[4];
5355
for (int j=0 ; j < 4; j++)
5456
indexData[i][j] = "("+j+", "+i+")";
57+
}
5558

5659
NdArray<String> matrix2d = StdArrays.ndCopyOf(indexData);
5760
assertEquals(2, matrix2d.rank());
@@ -63,6 +66,7 @@ public void testIndices(){
6366
|(0, 3), (1, 3), (2, 3), (3, 3)|
6467
|(0, 4), (1, 4), (2, 4), (3, 4)|
6568
*/
69+
assertArrayEquals(new String[]{"(0, 0)", "(1, 0)", "(2, 0)", "(3, 0)"}, indexData[0]);
6670

6771
NdArray<String> same1 = matrix2d.slice(Indices.all());
6872
String[][] same1j = StdArrays.array2dCopyOf(same1, String.class);

0 commit comments

Comments
 (0)