未验证 提交 14efb673 编写于 作者: P peterzhang2029 提交者: GitHub

Merge pull request #502 from peterzhang2029/add_sum_eval

Add sum eval for generate_sequence_by_rnn_lm.
......@@ -57,4 +57,4 @@ def rnn_lm(vocab_dim,
else:
cost = paddle.layer.classification_cost(input=output, label=target)
return cost, output
return cost
......@@ -43,9 +43,14 @@ def train(topology,
# create parameters
parameters = paddle.parameters.create(topology)
# create sum evaluator
sum_eval = paddle.evaluator.sum(topology)
# create trainer
trainer = paddle.trainer.SGD(
cost=topology, parameters=parameters, update_equation=adam_optimizer)
cost=topology,
parameters=parameters,
update_equation=adam_optimizer,
extra_layers=sum_eval)
# define the event_handler callback
def event_handler(event):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册