src/main/java/convnet/Data.java
/**
     * Stack current data on top of a 2d map of same dimensions.
     * @param input
     */
Stack current data on top of a 2d map of same dimensions.
@param input
Stack current data on top of a 2d map of same dimensions . @param input
public void stackMap(double[][] input) {
        int m = input.length;
        int n = input[0].length;
        if (this.data2d == null && this.data3d == null) {
            this.write(input);
        } else {
            if (m != this.dimensions[0] || n != this.dimensions[1]) {
                throw new RuntimeException("Cannot stack odd-sized map.");
            } else if (this.dimensions[2] == 0) {
                for (int i = 0; i < m; i++) {
                    for (int j = 0; j < n; j++) {
                        this.data3d[i][j][0] = this.data2d[i][j];
                    }
                }
                this.data2d = null;
                this.setDimensions3d();
            }
            int stackIndex = this.dimensions[2]++;
            for (int i = 0; i < m; i++) {
                for (int j = 0; j < n; j++) {
                    this.data3d[i][j][stackIndex] = input[i][j];
                }
            }
        }
    }
public void stackMap ( double [ ] [ ] input ) { int m = input . length ; int n = input [ 0 ] . length ; if ( this . data2d == null && this . data3d == null ) { this . write ( input ) ; } else { if ( m != this . dimensions [ 0 ] || n != this . dimensions [ 1 ] ) { throw new RuntimeException ( "Cannot stack odd-sized map." ) ; } else if ( this . dimensions [ 2 ] == 0 ) { for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { this . data3d [ i ] [ j ] [ 0 ] = this . data2d [ i ] [ j ] ; } } this . data2d = null ; this . setDimensions3d ( ) ; } int stackIndex = this . dimensions [ 2 ] ++ ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { this . data3d [ i ] [ j ] [ stackIndex ] = input [ i ] [ j ] ; } } } }
Stack current data on top of a 2d map of same dimensions.
Stack current data on top of a 2d map of same dimensions .