提交 6c209533 编写于 作者: P pkpk 提交者: Yibing Liu

test=develop (#2524)

上级 8539b677
...@@ -62,7 +62,7 @@ class Paradigm(object): ...@@ -62,7 +62,7 @@ class Paradigm(object):
ce_loss, probs = fluid.layers.softmax_with_cross_entropy( ce_loss, probs = fluid.layers.softmax_with_cross_entropy(
logits=logits, label=params['labels'], return_softmax=True) logits=logits, label=params['labels'], return_softmax=True)
loss = fluid.layers.mean(input=ce_loss) loss = fluid.layers.mean(x=ce_loss)
num_seqs = fluid.layers.create_tensor(dtype='int64') num_seqs = fluid.layers.create_tensor(dtype='int64')
accuracy = fluid.layers.accuracy( accuracy = fluid.layers.accuracy(
input=probs, label=params['labels'], total=num_seqs) input=probs, label=params['labels'], total=num_seqs)
...@@ -102,7 +102,7 @@ class Paradigm(object): ...@@ -102,7 +102,7 @@ class Paradigm(object):
ce_loss = fluid.layers.reduce_sum( ce_loss = fluid.layers.reduce_sum(
fluid.layers.sigmoid_cross_entropy_with_logits( fluid.layers.sigmoid_cross_entropy_with_logits(
x=logits, label=labels_onehot)) x=logits, label=labels_onehot))
loss = fluid.layers.mean(input=ce_loss) loss = fluid.layers.mean(x=ce_loss)
probs = fluid.layers.sigmoid(logits) probs = fluid.layers.sigmoid(logits)
if params['is_prediction']: if params['is_prediction']:
...@@ -158,7 +158,7 @@ class Paradigm(object): ...@@ -158,7 +158,7 @@ class Paradigm(object):
correct_prediction, dtype='float32')) correct_prediction, dtype='float32'))
ce_loss = fluid.layers.softmax_with_cross_entropy(logits=logits, \ ce_loss = fluid.layers.softmax_with_cross_entropy(logits=logits, \
label=fluid.layers.reshape(params['labels'], [-1, 1])) label=fluid.layers.reshape(params['labels'], [-1, 1]))
loss = fluid.layers.mean(input=ce_loss) loss = fluid.layers.mean(x=ce_loss)
loss.persistable = True loss.persistable = True
probs.persistable = True probs.persistable = True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册