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
评论列表
文章目录