Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#6401 transposei fix
  • Loading branch information
AlexDBlack committed Sep 17, 2018
1 parent 94c90e7 commit fe63f17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -4491,7 +4491,7 @@ public INDArray transpose() {
*/
@Override
public INDArray transposei() {
return permute(ArrayUtil.reverseCopy(ArrayUtil.range(0, rank())));
return permutei(ArrayUtil.reverseCopy(ArrayUtil.range(0, rank())));
}

protected INDArray create(DataBuffer data, int[] shape, int[] strides) {
Expand Down
Expand Up @@ -6954,6 +6954,17 @@ public void testSpecifiedIndexArraySize1() {
assertArrayEquals(expShape, arr.shape());
}

@Test
public void testTransposei(){
INDArray arr = Nd4j.linspace(1,12,12).reshape('c',3,4);

INDArray ti = arr.transposei();
assertArrayEquals(new long[]{4,3}, ti.shape());
assertArrayEquals(new long[]{4,3}, arr.shape());

assertTrue(arr == ti); //Should be same object
}

///////////////////////////////////////////////////////
protected static void fillJvmArray3D(float[][][] arr) {
int cnt = 1;
Expand Down

0 comments on commit fe63f17

Please sign in to comment.