word2vec_config.py 445 字节
Newer Older
Y
Yu Yang 已提交
1 2 3 4 5 6 7 8
... # the settings and define data provider is omitted.
DICT_DIM=3000  # dictionary dimension.
word_ids=data_layer('word_ids', size=DICT_DIM)

emb = embedding_layer(input=word_ids, size=256, param_attr=ParamAttr(sparse_update=True))
emb_sum = pooling_layer(input=emb, pooling_type=SumPooling())
predict = fc_layer(input=emb_sum, size=DICT_DIM, act=Softmax())
outputs(classification_cost(input=predict, label=data_layer('label', size=DICT_DIM)))