def get_grid_shape(m):
    r = int(np.sqrt(m))
    c = m // r
    while r * c < m:
        c += 1

    return (r, c)
Adjust the shape of the grid to show.
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/dbm/show_negative_chains.py/get_grid_shape