提交 be024485 编写于 作者: X xjqbest

fix

上级 60d1b7fc
...@@ -25,6 +25,7 @@ hyper_parameters: ...@@ -25,6 +25,7 @@ hyper_parameters:
optimizer: optimizer:
class: Adagrad class: Adagrad
learning_rate: 0.001 learning_rate: 0.001
is_sparse: False
mode: runner1 mode: runner1
......
...@@ -27,6 +27,7 @@ class Model(ModelBase): ...@@ -27,6 +27,7 @@ class Model(ModelBase):
self.emb_dim = 8 self.emb_dim = 8
self.hid_dim = 128 self.hid_dim = 128
self.class_dim = 2 self.class_dim = 2
self.is_sparse = envs.get_global_env("hyper_parameters.is_sparse", False)
def input_data(self, is_infer=False, **kwargs): def input_data(self, is_infer=False, **kwargs):
data = fluid.data( data = fluid.data(
...@@ -42,7 +43,7 @@ class Model(ModelBase): ...@@ -42,7 +43,7 @@ class Model(ModelBase):
seq_len = input[2] seq_len = input[2]
# embedding layer # embedding layer
emb = fluid.embedding(input=data, size=[self.dict_dim, self.emb_dim]) emb = fluid.embedding(input=data, size=[self.dict_dim, self.emb_dim], is_sparse=self.is_sparse)
emb = fluid.layers.sequence_unpad(emb, length=seq_len) emb = fluid.layers.sequence_unpad(emb, length=seq_len)
# convolution layer # convolution layer
conv = fluid.nets.sequence_conv_pool( conv = fluid.nets.sequence_conv_pool(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册