Пример #1
0
batch_size = 128
debug = 0

model = Model()
train_data = MNIST(name='train',
                   path=data_path)

valid_data = MNIST(name='valid',
                    path=data_path)

# Choose the random initialization method
init_W = InitCell('rand')
init_b = InitCell('zeros')

# Define nodes: objects
x, y = train_data.theano_vars()
mn_x, mn_y = valid_data.theano_vars()
# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)
    y.tag.test_value = np.zeros((batch_size, 1), dtype=np.float32)
    mn_x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)
    mn_y.tag.test_value = np.zeros((batch_size, 1), dtype=np.float32)

h1 = FullyConnectedLayer(name='h1',
                         parent=['x'],
                         parent_dim=[784],
                         nout=1000,
                         unit='relu',
                         init_W=init_W,
                         init_b=init_b)
Пример #2
0
save_path = '/home/junyoung/src/cle/saved/'

batch_size = 128
debug = 0

model = Model()
train_data = MNIST(name='train', path=data_path)

valid_data = MNIST(name='valid', path=data_path)

# Choose the random initialization method
init_W = InitCell('randn')
init_b = InitCell('zeros')

# Define nodes: objects
x, y = train_data.theano_vars()
# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)
    y.tag.test_value = np.zeros((batch_size, 1), dtype=np.float32)

h1 = FullyConnectedLayer(name='h1',
                         parent=['x'],
                         parent_dim=[784],
                         nout=1000,
                         unit='relu',
                         init_W=init_W,
                         init_b=init_b)

output = FullyConnectedLayer(name='output',
                             parent=['h1'],
Пример #3
0
inpsz = 784
latsz = 100
n_steps = 64
debug = 0

model = Model()
data = MNIST(name='train',
             unsupervised=1,
             path=datapath)

init_W = InitCell('rand')
init_U = InitCell('ortho')
init_b = InitCell('zeros')
init_b_sig = InitCell('const', mean=0.6)

x, _ = data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)

error = ErrorLayer(name='error',
                   parent=['x'],
                   recurrent=['canvas'],
                   batch_size=batch_size)

read_param = FullyConnectedLayer(name='read_param',
                                 parent=['dec_tm1'],
                                 parent_dim=[256],
                                 nout=5,
                                 unit='linear',
                                 init_W=init_W,
                                 init_b=init_b)
Пример #4
0
# Set your dataset
data_path = '/data/lisa/data/mnist/mnist.pkl'
save_path = '/u/chungjun/src/cle/saved/'

batch_size = 128
debug = 0

model = Model()
train_data = MNIST(name='train',
                   path=data_path)

valid_data = MNIST(name='valid',
                    path=data_path)

# Define nodes: objects
x, y = train_data.theano_vars()

# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)
    y.tag.test_value = np.zeros((batch_size, 1), dtype=np.float32)

# Choose the random initialization method
init_W = InitCell('rand')
init_b = InitCell('zeros')

h1 = FullyConnectedLayer(name='h1',
                         parent=['x'],
                         parent_dim=[784],
                         nout=1000,
                         unit='relu',
Пример #5
0
batch_size = 100
input_dim = 784
latent_dim = 100
n_steps = 64
debug = 0

model = Model()
data = MNIST(name='train', unsupervised=1, path=datapath)

init_W = InitCell('rand')
init_U = InitCell('ortho')
init_b = InitCell('zeros')
init_b_sig = InitCell('const', mean=0.6)

x, _ = data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)

error = ErrorLayer(name='error',
                   parent=['x'],
                   recurrent=['canvas'],
                   batch_size=batch_size)

read_param = FullyConnectedLayer(name='read_param',
                                 parent=['dec_tm1'],
                                 parent_dim=[256],
                                 nout=5,
                                 unit='linear',
                                 init_W=init_W,
                                 init_b=init_b)
Пример #6
0
#save_path = '/home/junyoung/src/cle/saved/'

batch_size = 128
debug = 0

model = Model()
train_data = MNIST(name='train', path=data_path)

valid_data = MNIST(name='valid', path=data_path)

# Choose the random initialization method
init_W = InitCell('rand')
init_b = InitCell('zeros')

# Define nodes: objects
x, y = train_data.theano_vars()
mn_x, mn_y = valid_data.theano_vars()
# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)
    y.tag.test_value = np.zeros((batch_size, 1), dtype=np.float32)
    mn_x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)
    mn_y.tag.test_value = np.zeros((batch_size, 1), dtype=np.float32)

h1 = FullyConnectedLayer(name='h1',
                         parent=['x'],
                         parent_dim=[784],
                         nout=1000,
                         unit='relu',
                         init_W=init_W,
                         init_b=init_b)
Пример #7
0
batch_size = 128
debug = 0

model = Model()
trdata = MNIST(name='train',
               path=data_path)
valdata = MNIST(name='valid',
                path=data_path)

# Choose the random initialization method
init_W = InitCell('randn')
init_b = InitCell('zeros')

# Define nodes: objects
model.inputs = trdata.theano_vars()
x, y = model.inputs
# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((batch_size, 784), dtype=np.float32)
    y.tag.test_value = np.zeros((batch_size, 1), dtype=np.float32)

inputs = [x, y]
inputs_dim = {'x':784, 'y':1}

onehot = OnehotLayer(name='onehot',
                     parent=['y'],
                     nout=10)

h1 = FullyConnectedLayer(name='h1',
                         parent=['x'],