def show_reconstructions(m, model_path):
    model = load_model(model_path, m)

    x = input('use test set? (y/n) ')
    dataset = load_dataset(model.dataset_yaml_src, x)
    vis_batch = dataset.get_batch_topo(m)
    pv = init_viewer(dataset, rows, cols, vis_batch)

    batch = model.visible_layer.space.make_theano_batch()
    reconstruction = model.reconstruct(batch)
    recons_func = function([batch], reconstruction)

    if hasattr(model.visible_layer, 'beta'):
        beta = model.visible_layer.beta.get_value()
        print('beta: ', (beta.min(), beta.mean(), beta.max()))

    while True:
        update_viewer(dataset, batch, rows, cols, pv, recons_func, vis_batch)
        pv.show()
        print('Displaying reconstructions. (q to quit, ENTER = show more)')
        while True:
            x = input()
            if x == 'q':
                quit()
            if x == '':
                x = 1
                break
            else:
                print('Invalid input, try again')

        vis_batch = dataset.get_batch_topo(m)
Show reconstructions of a given DBM model.
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/dbm/show_reconstructions.py/show_reconstructions