def test_sample_supervised(idxs=None, noisy=True):
    """
    Visualize samples and labels produced by GSN.
    """
    with open("gsn_sup_example.pkl") as f:
        gsn = pickle.load(f)

    gsn._corrupt_switch = noisy

    ds = MNIST(which_set='test')

    if idxs is None:
        data = ds.X[100:150]
    else:
        data = ds.X[idxs]

    # change the walkback parameter to make the data fill up rows in image
    samples = gsn.get_samples([(0, data)],
                              indices=[0, 2],
                              walkback=21, symbolic=False,
                              include_first=True)
    stacked = vis_samples(samples)
    tiled = image.tile_raster_images(stacked,
                                     img_shape=[28,28],
                                     tile_shape=[50,50],
                                     tile_spacing=(2,2))
    image.save("gsn_sup_example.png", tiled)
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/gsn_example.py/test_sample_supervised/original