Exemple #1
0
batch_size = 10
nlabel = 105
debug = 1

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

valid_data = Music(name='valid', path=data_path, nlabel=nlabel)

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

x, y, mask = train_data.theano_vars()
# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((10, batch_size, nlabel), dtype=np.float32)
    y.tag.test_value = np.zeros((10, batch_size, nlabel), dtype=np.float32)
    mask.tag.test_value = np.ones((10, batch_size), dtype=np.float32)

h1 = LSTM(name='h1',
          parent=['x'],
          parent_dim=[105],
          nout=50,
          unit='tanh',
          init_W=init_W,
          init_U=init_U,
          init_b=init_b)
Exemple #2
0
model = Model()
train_data = Music(name='train',
                   path=data_path,
                   nlabel=nlabel)

valid_data = Music(name='valid',
                   path=data_path,
                   nlabel=nlabel)

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

x, y, mask = train_data.theano_vars()
# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((10, batch_size, nlabel), dtype=np.float32)
    y.tag.test_value = np.zeros((10, batch_size, nlabel), dtype=np.float32)
    mask.tag.test_value = np.ones((10, batch_size), dtype=np.float32)

h1 = LSTM(name='h1',
          parent=['x'],
          parent_dim=[105],
          nout=50,
          unit='tanh',
          init_W=init_W,
          init_U=init_U,
          init_b=init_b)
Exemple #3
0
debug = 0

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

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

model.inputs = trdata.theano_vars()
x, y, mask = model.inputs
# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((10, batch_size, nlabel), dtype=np.float32)
    y.tag.test_value = np.zeros((10, batch_size, nlabel), dtype=np.float32)
    mask.tag.test_value = np.ones((10, batch_size), dtype=np.float32)

inputs = [x, y, mask]
inputs_dim = {'x':nlabel}

h1 = LSTM(name='h1',
          parent=['x'],
          batch_size=batch_size,
          nout=50,
          unit='tanh',