def init_viewer(dataset, rows, cols):
    m = rows * cols
    vis_batch = dataset.get_batch_topo(m)

    _, patch_rows, patch_cols, channels = vis_batch.shape

    assert _ == m

    mapback = hasattr(dataset, 'mapback_for_viewer')

    pv = PatchViewer((rows, cols*(1+mapback)),
                     (patch_rows, patch_cols),
                     is_color=(channels == 3))
    return pv
Initialisation of the PatchViewer with given rows and columns.
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/dbm/show_samples.py/init_viewer