Skip to content

Commit

Permalink
Additional util method for Shape class (#2799)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDBlack authored Mar 29, 2018
1 parent 8041327 commit 44dd3de
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2598,4 +2598,19 @@ public static boolean areShapesBroadcastable(@NonNull int[] x, @NonNull int[] y)

return true;
}


public static boolean hasDefaultStridesForShape(INDArray input){
if(!strideDescendingCAscendingF(input)){
return false;
}
char order = input.ordering();
int[] defaultStrides;
if(order == 'f'){
defaultStrides = ArrayUtil.calcStridesFortran(input.shape());
} else {
defaultStrides = ArrayUtil.calcStrides(input.shape());
}
return Arrays.equals(input.stride(), defaultStrides);
}
}

0 comments on commit 44dd3de

Please sign in to comment.