当前位置: 首页>>代码示例>>Python>>正文


Python recurrent.LSTM类代码示例

本文整理汇总了Python中cle.cle.layers.recurrent.LSTM的典型用法代码示例。如果您正苦于以下问题:Python LSTM类的具体用法?Python LSTM怎么用?Python LSTM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LSTM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main


#.........这里部分代码省略.........

    z_1 = FullyConnectedLayer(name='z_1',
                              parent=['z_t'],
                              parent_dim=[z_dim],
                              nout=z2s_dim,
                              unit='relu',
                              init_W=init_W,
                              init_b=init_b)

    z_2 = FullyConnectedLayer(name='z_2',
                              parent=['z_1'],
                              parent_dim=[z2s_dim],
                              nout=z2s_dim,
                              unit='relu',
                              init_W=init_W,
                              init_b=init_b)

    z_3 = FullyConnectedLayer(name='z_3',
                              parent=['z_2'],
                              parent_dim=[z2s_dim],
                              nout=z2s_dim,
                              unit='relu',
                              init_W=init_W,
                              init_b=init_b)

    z_4 = FullyConnectedLayer(name='z_4',
                              parent=['z_3'],
                              parent_dim=[z2s_dim],
                              nout=z2s_dim,
                              unit='relu',
                              init_W=init_W,
                              init_b=init_b)

    rnn = LSTM(name='rnn',
               parent=['x_4', 'z_4'],
               parent_dim=[x2s_dim, z2s_dim],
               nout=rnn_dim,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)

    phi_1 = FullyConnectedLayer(name='phi_1',
                                parent=['x_4', 's_tm1'],
                                parent_dim=[x2s_dim, rnn_dim],
                                nout=q_z_dim,
                                unit='relu',
                                init_W=init_W,
                                init_b=init_b)

    phi_2 = FullyConnectedLayer(name='phi_2',
                                parent=['phi_1'],
                                parent_dim=[q_z_dim],
                                nout=q_z_dim,
                                unit='relu',
                                init_W=init_W,
                                init_b=init_b)

    phi_3 = FullyConnectedLayer(name='phi_3',
                                parent=['phi_2'],
                                parent_dim=[q_z_dim],
                                nout=q_z_dim,
                                unit='relu',
                                init_W=init_W,
                                init_b=init_b)
开发者ID:kastnerkyle,项目名称:nips2015_vrnn,代码行数:66,代码来源:vrnn_gmm.py

示例2: FullyConnectedLayer

                          init_W=init_W,
                          init_b=init_b)

z_4 = FullyConnectedLayer(name='z_4',
                          parent=['z_3'],
                          parent_dim=[z2s_dim],
                          nout=z2s_dim,
                          unit='relu',
                          init_W=init_W,
                          init_b=init_b)

main_lstm = LSTM(name='main_lstm',
                 parent=['x_4', 'z_4'],
                 parent_dim=[x2s_dim, z2s_dim],
                 batch_size=batch_size,
                 nout=main_lstm_dim,
                 unit='tanh',
                 init_W=init_W,
                 init_U=init_U,
                 init_b=init_b)

phi_1 = FullyConnectedLayer(name='phi_1',
                            parent=['x_4', 's_tm1'],
                            parent_dim=[x2s_dim, main_lstm_dim],
                            nout=q_z_dim,
                            unit='relu',
                            init_W=init_W,
                            init_b=init_b)

phi_2 = FullyConnectedLayer(name='phi_2',
                            parent=['phi_1'],
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:31,代码来源:m2.py

示例3: InitCell

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

x = train_data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, frame_size), dtype=np.float32)
x_tm1 = T.concatenate([T.zeros((1, x.shape[1], x.shape[2])), x[:-1]], axis=0)
x_tm1.name = 'x_tm1'

encoder = LSTM(name='encoder',
               parent=['x_t'],
               parent_dim=[frame_size],
               batch_size=batch_size,
               nout=encoder_dim,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)

decoder = LSTM(name='decoder',
               parent=['x_tm1', 'z_t'],
               parent_dim=[frame_size, latent_size],
               batch_size=batch_size,
               nout=decoder_dim,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:30,代码来源:storn0_orig.py

示例4: main

def main(args):

    trial = int(args["trial"])
    pkl_name = "vrnn_gauss_%d" % trial
    channel_name = "valid_nll_upper_bound"

    data_path = args["data_path"]
    save_path = args["save_path"]

    monitoring_freq = int(args["monitoring_freq"])
    epoch = int(args["epoch"])
    batch_size = int(args["batch_size"])
    x_dim = int(args["x_dim"])
    z_dim = int(args["z_dim"])
    rnn_dim = int(args["rnn_dim"])
    lr = float(args["lr"])
    debug = int(args["debug"])

    print "trial no. %d" % trial
    print "batch size %d" % batch_size
    print "learning rate %f" % lr
    print "saving pkl file '%s'" % pkl_name
    print "to the save path '%s'" % save_path

    q_z_dim = 150
    p_z_dim = 150
    p_x_dim = 250
    x2s_dim = 250
    z2s_dim = 150
    target_dim = x_dim - 1

    model = Model()
    train_data = IAMOnDB(name="train", prep="normalize", cond=False, path=data_path)

    X_mean = train_data.X_mean
    X_std = train_data.X_std

    valid_data = IAMOnDB(name="valid", prep="normalize", cond=False, path=data_path, X_mean=X_mean, X_std=X_std)

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

    x, mask = train_data.theano_vars()

    if debug:
        x.tag.test_value = np.zeros((15, batch_size, x_dim), dtype=np.float32)
        temp = np.ones((15, batch_size), dtype=np.float32)
        temp[:, -2:] = 0.0
        mask.tag.test_value = temp

    x_1 = FullyConnectedLayer(
        name="x_1", parent=["x_t"], parent_dim=[x_dim], nout=x2s_dim, unit="relu", init_W=init_W, init_b=init_b
    )

    z_1 = FullyConnectedLayer(
        name="z_1", parent=["z_t"], parent_dim=[z_dim], nout=z2s_dim, unit="relu", init_W=init_W, init_b=init_b
    )

    rnn = LSTM(
        name="rnn",
        parent=["x_1", "z_1"],
        parent_dim=[x2s_dim, z2s_dim],
        nout=rnn_dim,
        unit="tanh",
        init_W=init_W,
        init_U=init_U,
        init_b=init_b,
    )

    phi_1 = FullyConnectedLayer(
        name="phi_1",
        parent=["x_1", "s_tm1"],
        parent_dim=[x2s_dim, rnn_dim],
        nout=q_z_dim,
        unit="relu",
        init_W=init_W,
        init_b=init_b,
    )

    phi_mu = FullyConnectedLayer(
        name="phi_mu", parent=["phi_1"], parent_dim=[q_z_dim], nout=z_dim, unit="linear", init_W=init_W, init_b=init_b
    )

    phi_sig = FullyConnectedLayer(
        name="phi_sig",
        parent=["phi_1"],
        parent_dim=[q_z_dim],
        nout=z_dim,
        unit="softplus",
        cons=1e-4,
        init_W=init_W,
        init_b=init_b_sig,
    )

    prior_1 = FullyConnectedLayer(
        name="prior_1", parent=["s_tm1"], parent_dim=[rnn_dim], nout=p_z_dim, unit="relu", init_W=init_W, init_b=init_b
    )

#.........这里部分代码省略.........
开发者ID:vseledkin,项目名称:nips2015_vrnn,代码行数:101,代码来源:vrnn_gauss.py

示例5: FullyConnectedLayer

                          init_W=init_W,
                          init_b=init_b)

x_4 = FullyConnectedLayer(name='x_4',
                          parent=['x_3'],
                          parent_dim=[x2s_dim],
                          nout=x2s_dim,
                          unit='relu',
                          init_W=init_W,
                          init_b=init_b)

main_lstm = LSTM(name='main_lstm',
             parent=['x_4'],
             parent_dim=[x2s_dim],
             batch_size=batch_size,
             nout=main_lstm_dim,
             unit='tanh',
             init_W=init_W,
             init_U=init_U,
             init_b=init_b)

theta_1 = FullyConnectedLayer(name='theta_1',
                              parent=['s_tm1'],
                              parent_dim=[main_lstm_dim],
                              nout=p_x_dim,
                              unit='relu',
                              init_W=init_W,
                              init_b=init_b)

theta_2 = FullyConnectedLayer(name='theta_2',
                              parent=['theta_1'],
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:31,代码来源:m0.py

示例6: FullyConnectedLayer

                          init_W=init_W,
                          init_b=init_b)

z_4 = FullyConnectedLayer(name='z_4',
                          parent=['z_3'],
                          parent_dim=[z2s_dim],
                          nout=z2s_dim,
                          unit='relu',
                          init_W=init_W,
                          init_b=init_b)

lstm_1 = LSTM(name='lstm_1',
              parent=['x_4', 'z_4'],
              parent_dim=[x2s_dim, z2s_dim],
              batch_size=batch_size,
              nout=lstm_1_dim,
              unit='tanh',
              init_W=init_W,
              init_U=init_U,
              init_b=init_b)

lstm_2 = LSTM(name='lstm_2',
              parent=['lstm_1'],
              parent_dim=[lstm_1_dim],
              batch_size=batch_size,
              nout=lstm_2_dim,
              unit='tanh',
              init_W=init_W,
              init_U=init_U,
              init_b=init_b)
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:30,代码来源:deep_m2.py

示例7: main

def main(args):

    trial = int(args['trial'])
    pkl_name = 'rnn_gauss_%d' % trial
    channel_name = 'valid_nll'

    data_path = args['data_path']
    save_path = args['save_path']

    monitoring_freq = int(args['monitoring_freq'])
    epoch = int(args['epoch'])
    batch_size = int(args['batch_size'])
    x_dim = int(args['x_dim'])
    z_dim = int(args['z_dim'])
    rnn_dim = int(args['rnn_dim'])
    lr = float(args['lr'])
    debug = int(args['debug'])

    print "trial no. %d" % trial
    print "batch size %d" % batch_size
    print "learning rate %f" % lr
    print "saving pkl file '%s'" % pkl_name
    print "to the save path '%s'" % save_path

    x2s_dim = 340
    s2x_dim = 340
    target_dim = x_dim - 1

    model = Model()
    train_data = IAMOnDB(name='train',
                         prep='normalize',
                         cond=False,
                         path=data_path)

    X_mean = train_data.X_mean
    X_std = train_data.X_std

    valid_data = IAMOnDB(name='valid',
                         prep='normalize',
                         cond=False,
                         path=data_path,
                         X_mean=X_mean,
                         X_std=X_std)

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

    x, mask = train_data.theano_vars()

    if debug:
        x.tag.test_value = np.zeros((15, batch_size, x_dim), dtype=np.float32)
        temp = np.ones((15, batch_size), dtype=np.float32)
        temp[:, -2:] = 0.
        mask.tag.test_value = temp


    x_1 = FullyConnectedLayer(name='x_1',
                              parent=['x_t'],
                              parent_dim=[x_dim],
                              nout=x2s_dim,
                              unit='relu',
                              init_W=init_W,
                              init_b=init_b)

    rnn = LSTM(name='rnn',
               parent=['x_1'],
               parent_dim=[x2s_dim],
               nout=rnn_dim,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)

    theta_1 = FullyConnectedLayer(name='theta_1',
                                  parent=['s_tm1'],
                                  parent_dim=[rnn_dim],
                                  nout=s2x_dim,
                                  unit='relu',
                                  init_W=init_W,
                                  init_b=init_b)

    theta_mu = FullyConnectedLayer(name='theta_mu',
                                   parent=['theta_1'],
                                   parent_dim=[s2x_dim],
                                   nout=target_dim,
                                   unit='linear',
                                   init_W=init_W,
                                   init_b=init_b)

    theta_sig = FullyConnectedLayer(name='theta_sig',
                                    parent=['theta_1'],
                                    parent_dim=[s2x_dim],
                                    nout=target_dim,
                                    unit='softplus',
                                    cons=1e-4,
                                    init_W=init_W,
                                    init_b=init_b_sig)

#.........这里部分代码省略.........
开发者ID:xzhang311,项目名称:nips2015_vrnn,代码行数:101,代码来源:rnn_gauss.py

示例8: LSTM

x = train_data.theano_vars()
mn_x = valid_data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, frame_size), dtype=theano.config.floatX)
    mn_x.tag.test_value = np.zeros((15, mn_batch_size, frame_size), dtype=theano.config.floatX)
x_tm1 = T.concatenate([T.zeros((1, x.shape[1], x.shape[2])), x[:-1]], axis=0)
x_tm1.name = 'x_tm1'
mn_x_tm1 = T.concatenate([T.zeros((1, mn_x.shape[1], mn_x.shape[2])), mn_x[:-1]], axis=0)
mn_x_tm1.name = 'mn_x_tm1'

encoder = LSTM(name='encoder',
               parent=['x_t'],
               parent_dim=[frame_size],
               batch_size=batch_size,
               nout=encoder_dim,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)

decoder = LSTM(name='decoder',
               parent=['x_tm1', 'z_t'],
               parent_dim=[frame_size, latent_size],
               batch_size=batch_size,
               nout=decoder_dim,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:29,代码来源:storn0_orig.py

示例9: InitCell

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

x, mask = trdata.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, inpsz), dtype=np.float32)
    temp = np.ones((15, batch_size), dtype=np.float32)
    temp [:, -2:] = 0.
    mask.tag.test_value = temp

coder_1 = LSTM(name='coder_1',
               parent=['x_t', 'z_1_t', 'z_2_t'],
               parent_dim=[inpsz, latsz_1, latsz_2],
               batch_size=batch_size,
               nout=shared_nout_1,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)

phi_emb_1 = FullyConnectedLayer(name='phi_emb_1',
                                parent=['x_t', 's_1_tm1', 's_2_tm1'],
                                parent_dim=[inpsz, shared_nout_1, shared_nout_2],
                                nout=lat_emb,
                                #unit='tanh',
                                unit='relu',
                                init_W=init_W,
                                init_b=init_b)

phi_mu_1 = FullyConnectedLayer(name='phi_mu_1',
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:31,代码来源:stacked_rnnvae.py

示例10: InitCell

init_b_sig = InitCell('const', mean=0.6)

x, mask = trdata.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, inpsz), dtype=np.float32)
    temp = np.ones((15, batch_size), dtype=np.float32)
    temp [:, -2:] = 0.
    mask.tag.test_value = temp
x2 = T.concatenate([T.zeros((1, x.shape[1], x.shape[2])), x[:-1]], axis=0)
x2.name = 'x2'

encoder = LSTM(name='encoder',
               parent=['x_t'],
               parent_dim=[inpsz],
               batch_size=batch_size,
               nout=enc_nout,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)

decoder = LSTM(name='decoder',
               parent=['z_t'],
               parent_dim=[latsz],
               batch_size=batch_size,
               nout=dec_nout,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:30,代码来源:rnnvae_free_theta_sig_decouple.py

示例11: FullyConnectedLayer

                          unit='relu',
                          init_W=init_W,
                          init_b=init_b)

x_4 = FullyConnectedLayer(name='x_4',
                          parent=['x_3'],
                          parent_dim=[x2s_dim],
                          nout=x2s_dim,
                          unit='relu',
                          init_W=init_W,
                          init_b=init_b)

rnn = LSTM(name='rnn',
           parent=['x_4'],
           parent_dim=[x2s_dim],
           nout=rnn_dim,
           unit='tanh',
           init_W=init_W,
           init_U=init_U,
           init_b=init_b)

theta_1 = FullyConnectedLayer(name='theta_1',
                              parent=['s_tm1'],
                              parent_dim=[rnn_dim],
                              nout=p_x_dim,
                              unit='relu',
                              init_W=init_W,
                              init_b=init_b)

theta_2 = FullyConnectedLayer(name='theta_2',
                              parent=['theta_1'],
                              parent_dim=[p_x_dim],
开发者ID:LEONOB2014,项目名称:nips2015_vrnn,代码行数:32,代码来源:rnn_gmm.py

示例12: InitCell

# 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)

h2 = LSTM(name='h2',
          parent=['h1'],
          parent_dim=[50],
          nout=50,
          unit='tanh',
          init_W=init_W,
          init_U=init_U,
          init_b=init_b)

h3 = LSTM(name='h3',
          parent=['h2'],
开发者ID:BigeyeDestroyer,项目名称:cle,代码行数:32,代码来源:music.py

示例13: ReadLayer

                                 nout=5,
                                 unit='linear',
                                 init_W=init_W,
                                 init_b=init_b)

read = ReadLayer(name='read',
                 parent=['x', 'error', 'read_param'],
                 glimpse_shape=(batch_size, 1, 2, 2),
                 input_shape=(batch_size, 1, 28, 28))

enc = LSTM(name='enc',
           parent=['read'],
           parent_dim=[8],
           recurrent=['dec'],
           recurrent_dim=[256],
           batch_size=batch_size,
           nout=256,
           unit='tanh',
           init_W=init_W,
           init_U=init_U,
           init_b=init_b)

phi_mu = FullyConnectedLayer(name='phi_mu',
                             parent=['enc'],
                             parent_dim=[256],
                             nout=latsz,
                             unit='linear',
                             init_W=init_W,
                             init_b=init_b)

phi_sig = FullyConnectedLayer(name='phi_sig',
开发者ID:anirudh9119,项目名称:cle,代码行数:31,代码来源:draw.py

示例14: InitCell

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

x, mask = trdata.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, inpsz), dtype=np.float32)
    temp = np.ones((15, batch_size), dtype=np.float32)
    temp [:, -2:] = 0.
    mask.tag.test_value = temp

coder = LSTM(name='coder',
             parent=['x_t', 'z_t'],
             parent_dim=[inpsz, latsz],
             batch_size=batch_size,
             nout=shared_nout,
             unit='tanh',
             init_W=init_W,
             init_U=init_U,
             init_b=init_b)

phi_mu = FullyConnectedLayer(name='phi_mu',
                             parent=['x_t', 's_tm1'],
                             parent_dim=[inpsz, shared_nout],
                             nout=latsz,
                             unit='linear',
                             init_W=init_W,
                             init_b=init_b)

phi_sig = FullyConnectedLayer(name='phi_sig',
                              parent=['x_t', 's_tm1'],
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:31,代码来源:condsig.py

示例15: FullyConnectedLayer

                          init_W=init_W,
                          init_b=init_b)

z_4 = FullyConnectedLayer(name='z_4',
                          parent=['z_3'],
                          parent_dim=[z2s_dim],
                          nout=z2s_dim,
                          unit='relu',
                          init_W=init_W,
                          init_b=init_b)

encoder = LSTM(name='encoder',
               parent=['x_4'],
               parent_dim=[x2s_dim],
               batch_size=batch_size,
               nout=encoder_dim,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)

decoder = LSTM(name='decoder',
               parent=['x_4_tm1', 'z_4'],
               parent_dim=[x2s_dim, z2s_dim],
               batch_size=batch_size,
               nout=decoder_dim,
               unit='tanh',
               init_W=init_W,
               init_U=init_U,
               init_b=init_b)
开发者ID:anirudh9119,项目名称:SpeechSyn,代码行数:30,代码来源:storn0_3.py


注:本文中的cle.cle.layers.recurrent.LSTM类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。