TensorOps { public static int outerLength(int[] shape , int startDimen ) { if( startDimen >= shape.length ) return 0; int D = 1; for (int i = startDimen; i < shape.length; i++) { D *= shape[i]; } return D; }  static List<T> WT(T ...elements ); static int[] WI( int ... elements ); static int[] WI( int a , int[] elements ); static int[] WI( int[] elements , int a ); static int[] TH(int[] elements ); static List<int[]> WI( int a , List<int[]> list ); static T AD( T input ); static int sumTensorLength( List<int[]> shapes ); static int tensorLength( int... shape ); static void checkShape(String which, List<int[]> expected , List<Tensor<?>> actual , boolean ignoreAxis0 ); static void checkShape( Tensor_F64 a , Tensor_F64 b ); static void checkShape( Tensor_F32 a , Tensor_F32 b ); static void checkShape(String which, int tensor, int[] expected, int[] actual, boolean ignoreAxis0 ); static String toStringShapeA( int []shape ); static String toStringShape( int []shape ); static int outerLength(int[] shape , int startDimen ); static File pathToRoot(); static double elementSum( Tensor tensor ); static void fill( Tensor t , double value ); static void boundSpatial( int bounds[] , int rows , int cols );  }
@Test public void outerLength() { int shape[] = new int[]{5,2,3,2}; assertEquals(2, TensorOps.outerLength(shape,3)); assertEquals(6, TensorOps.outerLength(shape,2)); assertEquals(12, TensorOps.outerLength(shape,1)); assertEquals(60, TensorOps.outerLength(shape,0)); }