未验证 提交 6d637a93 编写于 作者: L lilu 提交者: GitHub

test=develop (#2249)

上级 0a31618b
......@@ -11,10 +11,12 @@ import math
import paddle.fluid as fluid
import paddle
class Network(object):
"""
Network
"""
def __init__(self,
vocab_size,
emb_size,
......@@ -44,8 +46,7 @@ class Network(object):
name="context_wordseq", shape=[1], dtype="int64", lod_level=1)
response_wordseq = fluid.layers.data(
name="response_wordseq", shape=[1], dtype="int64", lod_level=1)
label = fluid.layers.data(
name="label", shape=[1], dtype="float32")
label = fluid.layers.data(name="label", shape=[1], dtype="float32")
self._feed_name = ["context_wordseq", "response_wordseq", "label"]
self._feed_infer_name = ["context_wordseq", "response_wordseq"]
......@@ -111,6 +112,7 @@ class Network(object):
elif loss_type == 'L2':
norm_score = 2 * fluid.layers.sigmoid(logits)
loss = fluid.layers.square_error_cost(norm_score, label) / 4
loss = fluid.layers.reduce_mean(loss)
else:
raise ValueError
......@@ -135,4 +137,3 @@ class Network(object):
Return inference names
"""
return self._feed_infer_name
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册