def get_sample_func(model, layer_to_state, x):
    theano_rng = MRG_RandomStreams(2012+9+18)

    if x > 0:
        sampling_updates = model.get_sampling_updates(
            layer_to_state,
            theano_rng,
            layer_to_clamp={model.visible_layer: True},
            num_steps=x)

        t1 = time.time()
        sample_func = function([], updates=sampling_updates)
        t2 = time.time()
        print('Clamped sampling function compilation took', t2-t1)
        sample_func()

    # Now compile the full sampling update
    sampling_updates = model.get_sampling_updates(layer_to_state,
                                                  theano_rng)
    assert layer_to_state[model.visible_layer] in sampling_updates

    t1 = time.time()
    sample_func = function([], updates=sampling_updates)
    t2 = time.time()
    print('Sampling function compilation took', t2-t1)

    return sample_func
Grab initrd or kernel image.
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/dbm/show_samples.py/get_sample_func--crossover with--dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/libvirt/utils.py/fetch_raw_image