src/main/java/convnet/NumPute.java
/**
     * Returns a random 3d matrix of given shape.
     * @param shape
     * @return
     */
Returns a random 3d matrix of given shape.
@param shape
@return
Returns a random 3d matrix of given shape . @param shape @return
public static double[][][] random3dMatrix(int[] shape) {
        int m = shape[0];
        int n = shape[1];
        int o = shape[2];
        double[][][] result = new double[m][n][o];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                for (int k = 0; k < o; k++) {
                    result[i][j][k] = new Random().nextDouble();
                }
            }
        }
        return result;
    }
public static double [ ] [ ] [ ] random3dMatrix ( int [ ] shape ) { int m = shape [ 0 ] ; int n = shape [ 1 ] ; int o = shape [ 2 ] ; double [ ] [ ] [ ] result = new double [ m ] [ n ] [ o ] ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { for ( int k = 0 ; k < o ; k ++ ) { result [ i ] [ j ] [ k ] = new Random ( ) . nextDouble ( ) ; } } } return result ; }
Returns a random 3d matrix of given shape.
Returns a random 3d matrix of given shape .