未验证 提交 5a3bd669 编写于 作者: Q Qdriving 提交者: GitHub

Update model.py

上级 0ededf12
...@@ -234,29 +234,32 @@ class Model(ModelBase): ...@@ -234,29 +234,32 @@ class Model(ModelBase):
aux_loss = 0 aux_loss = 0
else: else:
test_pos = fluid.layers.reduce_sum( test_pos = fluid.layers.reduce_sum(
fluid.layers.reduce_sum( fluid.layers.reduce_sum(
fluid.layers.log( fluid.layers.log(
fluid.layers.sigmoid( fluid.layers.sigmoid(
fluid.layers.reduce_sum( fluid.layers.reduce_sum(
gru_out_pad[:, start_value:seq_shape[1] - 1, :] * gru_out_pad[:, start_value:seq_shape[1] - 1, :]
pos_seq_pad[:, start_value + 1:seq_shape[1], :], * pos_seq_pad[:, start_value + 1:seq_shape[
dim=2, 1], :],
keep_dim=True))), dim=2,
dim=2), keep_dim=True))),
dim=1, dim=2),
keep_dim=True) dim=1,
keep_dim=True)
test_neg = fluid.layers.reduce_sum( test_neg = fluid.layers.reduce_sum(
fluid.layers.reduce_sum(
fluid.layers.log( fluid.layers.log(
fluid.layers.sigmoid( fluid.layers.sigmoid(
fluid.layers.reduce_sum( fluid.layers.reduce_sum(
gru_out_pad[:, start_value:seq_shape[1] - 1, :] * gru_out_pad[:, start_value:seq_shape[1] - 1, :]
neg_seq_pad[:, start_value + 1:seq_shape[1], :], * neg_seq_pad[:, start_value + 1:seq_shape[
1], :],
dim=2, dim=2,
keep_dim=True))), keep_dim=True))),
dim=2), dim=2),
dim=1, dim=1,
keep_dim=True) keep_dim=True)
aux_loss = fluid.layers.mean(test_neg + test_pos) aux_loss = fluid.layers.mean(test_neg + test_pos)
# ------------------------- Interest Evolving Layer (GRU with attentional input (AIGRU)) -------------------------- # ------------------------- Interest Evolving Layer (GRU with attentional input (AIGRU)) --------------------------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册