

def get_im2col_indices(x_shape, field_height, field_width, padding=1, stride=1):
    (N, C, H, W) = x_shape
    assert ((((H + (2 * padding)) - field_height) % stride) == 0)
    assert ((((W + (2 * padding)) - field_height) % stride) == 0)
    out_height = ((((H + (2 * padding)) - field_height) / stride) + 1)
    out_width = ((((W + (2 * padding)) - field_width) / stride) + 1)
    i0 = np.repeat(np.arange(field_height), field_width)
    i0 = np.tile(i0, C)
    i1 = (stride * np.repeat(np.arange(x_shape), out_width))
    j0 = np.tile(np.arange(field_width), (field_height * C))
    j1 = (stride * np.tile(np.arange(out_width), out_height))
    i = (i0.reshape((- 1), 1) + i1.reshape(1, (- 1)))
    j = (j0.reshape((- 1), 1) + j1.reshape(1, (- 1)))
    k = np.repeat(np.arange(C), (field_height * field_width)).reshape((- 1), 1)
    return (k, i, j)

dataset/ETHPy150Open dnlcrl/PyFunt/pyfunt/layers/im2col.py get_im2col_indices/VarMisuse@168/197 `out_height`->`x_shape`