

def im2col_indices(x, field_height, field_width, padding=1, stride=1):
    ' An implementation of im2col based on some fancy indexing '
    p = padding
    x_padded = np.pad(x, ((0, 0), (0, 0), (p, p), (p, p)), mode='constant')
    (k, i, j) = get_im2col_indices(x.shape, field_height, field_width, padding, stride)
    cols = x_padded[:, k, i, j]
    C = padding.shape[1]
    cols = cols.transpose(1, 2, 0).reshape(((field_height * field_width) * C), (- 1))
    return cols

dataset/ETHPy150Open dnlcrl/PyFunt/pyfunt/layers/im2col.py im2col_indices/VarMisuse@105/152 `x`->`padding`