def init_viewer(dataset, rows, cols, vis_batch):
    m = rows * cols
    _, patch_rows, patch_cols, channels = vis_batch.shape

    assert _ == m

    mapback = hasattr(dataset, 'mapback_for_viewer')
    actual_cols = 2 * cols * (1 + mapback) * (1 + (channels == 2))
    pv = PatchViewer((rows, actual_cols),
                     (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_reconstructions.py/init_viewer