public static INDArray im2col(INDArray img, int kh, int kw, int sy, int sx, int ph, int pw, boolean isSameMode, INDArray out) { Im2col im2col = new Im2col(img, kh, kw, sy, sx, ph, pw, isSameMode, out); return Nd4j.getExecutioner().exec(im2col).z(); }
/** * Implement column formatted images * @param img the image to process * @param kh the kernel height * @param kw the kernel width * @param sy the stride along y * @param sx the stride along x * @param ph the padding width * @param pw the padding height * @param pval the padding value (not used) * @param isSameMode whether padding mode is 'same' * @return the column formatted image * */ public static INDArray im2col(INDArray img, int kh, int kw, int sy, int sx, int ph, int pw, int pval, boolean isSameMode) { Im2col im2col = new Im2col(img, kh, kw, sy, sx, ph, pw, isSameMode); return Nd4j.getExecutioner().exec(im2col).z(); }
/** * Implement column formatted images * @param img the image to process * @param kh the kernel height * @param kw the kernel width * @param sy the stride along y * @param sx the stride along x * @param ph the padding width * @param pw the padding height * @param isSameMode whether to cover the whole image or not * @return the column formatted image * */ public static INDArray im2col(INDArray img, int kh, int kw, int sy, int sx, int ph, int pw, boolean isSameMode) { Nd4j.getCompressor().autoDecompress(img); Im2col im2col = new Im2col(img, kh, kw, sy, sx, ph, pw, isSameMode); return Nd4j.getExecutioner().exec(im2col).z(); }