nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/Convolution.java
public static INDArray col2im(INDArray col, int sy, int sx, int ph, int pw, int h, int w) {
        if (col.rank() != 6)
            throw new IllegalArgumentException("col2im input array must be rank 6");

        INDArray output = Nd4j.create(new long[]{col.size(0), col.size(1), h, w});

        Col2Im col2Im = Col2Im.builder()
                .inputArrays(new  INDArray[]{col})
                .outputs(new INDArray[]{output})
                .conv2DConfig(Conv2DConfig.builder()
                        .sy(sy)
                        .sx(sx)
                        .dw(1)
                        .dh(1)
                        .kh(h)
                        .kw(w)
                        .ph(ph)
                        .pw(pw)
                        .build())
                .build();

        Nd4j.getExecutioner().exec(col2Im);
        return col2Im.outputArguments()[0];
    }
public static INDArray col2im(INDArray col, int sy, int sx, int ph, int pw, int h, int w) {
        if (col.rank() != 6)
            throw new IllegalArgumentException("col2im input array must be rank 6");

        INDArray output = Nd4j.create(new long[]{col.size(0), col.size(1), h, w});

        Col2Im col2Im = Col2Im.builder()
                .inputArrays(new  INDArray[]{col})
                .outputs(new INDArray[]{output})
                .conv2DConfig(Conv2DConfig.builder()
                        .sy(sy)
                        .sx(sx)
                        .dw(1)
                        .dh(1)
                        .kh(h)
                        .kw(w)
                        .ph(ph)
                        .pw(pw)
                        .build())
                .build();

        Nd4j.getExecutioner().exec(col2Im);
        return col2Im.outputArguments()[0];
    }
public static INDArray col2im ( INDArray col , int sy , int sx , int ph , int pw , int h , int w ) { if ( col . rank ( ) != 6 ) throw new IllegalArgumentException ( "col2im input array must be rank 6" ) ; INDArray output = Nd4j . create ( new long [ ] { col . size ( 0 ) , col . size ( 1 ) , h , w } ) ; Col2Im col2Im = Col2Im . builder ( ) . inputArrays ( new INDArray [ ] { col } ) . outputs ( new INDArray [ ] { output } ) . conv2DConfig ( Conv2DConfig . builder ( ) . sy ( sy ) . sx ( sx ) . dw ( 1 ) . dh ( 1 ) . kh ( h ) . kw ( w ) . ph ( ph ) . pw ( pw ) . build ( ) ) . build ( ) ; Nd4j . getExecutioner ( ) . exec ( col2Im ) ; return col2Im . outputArguments ( ) [ 0 ] ; }
Rearrange matrix
columns into blocks

@param col the column
transposed image to convert
@param sy stride y
@param sx stride x
@param ph padding height
@param pw padding width
@param h height
@param w width
@return
Rearrange matrix columns into blocks