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

5 6
emb = embedding_layer(
    input=word_ids, size=256, param_attr=ParamAttr(sparse_update=True))
Y
Yu Yang 已提交
7 8
emb_sum = pooling_layer(input=emb, pooling_type=SumPooling())
predict = fc_layer(input=emb_sum, size=DICT_DIM, act=Softmax())
9 10 11 12
outputs(
    classification_cost(
        input=predict, label=data_layer(
            'label', size=DICT_DIM)))