gru_model.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:rnn_music 作者: zhegan27 项目源码 文件源码
def build_model(tparams,options):

    #trng = RandomStreams(SEED)

    # Used for dropout.
    #use_noise = theano.shared(numpy_floatX(0.))

    # x: n_steps * n_x
    x = tensor.matrix('x', dtype=config.floatX)      
    n_steps = x.shape[0]                                                                              

    h_decoder = decoder_layer(tparams, x)

    pred = tensor.nnet.sigmoid(tensor.dot(h_decoder,tparams['Vhid']) + tparams['bhid'])

    f_pred = theano.function([x],pred)

    cost = tensor.sum(tensor.nnet.binary_crossentropy(pred,x))/n_steps                         

    return x, f_pred, cost
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号