未验证 提交 0ededf12 编写于 作者: Q Qdriving 提交者: GitHub

Length of hist_item_seq[batch_size][i] error

The condition that max length of hist_item_seq[batch_size][i] == 1 is not covered. But it is happened when I run the baseline of dien model.
上级 5f7ffbc2
...@@ -229,7 +229,11 @@ class Model(ModelBase): ...@@ -229,7 +229,11 @@ class Model(ModelBase):
neg_seq_pad, _ = fluid.layers.sequence_pad(neg_reshape_hist_item_emb, neg_seq_pad, _ = fluid.layers.sequence_pad(neg_reshape_hist_item_emb,
pad_value) pad_value)
seq_shape = fluid.layers.shape(pos_seq_pad) seq_shape = fluid.layers.shape(pos_seq_pad)
test_pos = fluid.layers.reduce_sum(
if(seq_shape[1] < 2):
aux_loss = 0
else:
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(
...@@ -241,7 +245,7 @@ class Model(ModelBase): ...@@ -241,7 +245,7 @@ class Model(ModelBase):
dim=2), dim=2),
dim=1, dim=1,
keep_dim=True) keep_dim=True)
test_neg = fluid.layers.reduce_sum( test_neg = fluid.layers.reduce_sum(
fluid.layers.reduce_sum( fluid.layers.reduce_sum(
fluid.layers.log( fluid.layers.log(
fluid.layers.sigmoid( fluid.layers.sigmoid(
...@@ -253,7 +257,7 @@ class Model(ModelBase): ...@@ -253,7 +257,7 @@ class Model(ModelBase):
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.
先完成此消息的编辑!
想要评论请 注册