# path for dumping experiment info and fetching dataset
EXP_DIR = "./omniglot"

# setup paths for dumping diagnostic info
desc = 'test_uncond_gru'
result_dir = "{}/results/{}".format(EXP_DIR, desc)
inf_gen_param_file = "{}/inf_gen_params.pkl".format(result_dir)
if not os.path.exists(result_dir):
    os.makedirs(result_dir)

# load MNIST dataset, either fixed or dynamic binarization
data_path = "{}/data/".format(EXP_DIR)
Xtr, Ytr, Xva, Yva = load_omniglot(data_path, target_type='one-hot')


set_seed(123)      # seed for shared rngs
nc = 1             # # of channels in image
nbatch = 100       # # of examples in batch
npx = 28           # # of pixels width/height of images
nz0 = 64           # # of dim for Z0
nz1 = 4            # # of dim for Z1
ngf = 32           # base # of channels for defining layers
nx = npx * npx * nc  # # of dimensions in X
niter = 150        # # of iter at starting learning rate
niter_decay = 250  # # of iter to linearly decay learning rate to zero
td_act_func = 'tanh'   # activation function for top-down modules
bu_act_func = 'lrelu'  # activation function for bottom-up modules
td_act_func = 'tanh'   # activation function for information merging modules
use_td_cond = True

ntrain = Xtr.shape[0]
Esempio n. 2
0
if args.encode_net_fc_dims is not None:
    args.encode_net_fc_dims = \
        [int(d) for d in args.encode_net_fc_dims.split(',') if d]
if args.cond_fc_dims is not None:
    args.cond_fc_dims = \
        [int(d) for d in args.cond_fc_dims.split(',') if d]
if args.minibatch_layer_size is not None:
    args.minibatch_layer_size = \
        [int(d) for d in args.minibatch_layer_size.split(',') if d]
    assert len(args.minibatch_layer_size) == 3
if args.post_minibatch_layer_dims is not None:
    args.post_minibatch_layer_dims = \
        [int(d) for d in args.post_minibatch_layer_dims.split(',') if d]

if args.seed is not None:
    rng.set_seed(args.seed)
py_rng = rng.py_rng
np_rng = rng.np_rng
t_rng = rng.t_rng

from lib import updates
from lib.theano_utils import floatX, sharedX
from lib.data_utils import shuffle, list_shuffle
from lib.metrics import nnc_score, nnd_score

from net import Output, L, Net
from dist import MultiDistribution
import gan

bnkwargs = dict(bnkwargs=dict(
    batch_norm=(not args.nobn),