L1aoXingyu / mxnet-tutorial

my simple tutorial for mxnet, a fast deep learning framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to use pre-trained word embedding?

NonvolatileMemory opened this issue · comments

your code is so awesome.
But if I want to use pre-trained embedding matrix to initialize gluon.nn.Embedding(),what should I do?

you can define a initial word embedding and then set the weight by yourself, such as

x = nn.Embedding(3, 5)
x.initialize()
x.weight.set_data(nd.ones(shape=(3, 5))
print(x.weight.data())

seems this method is wrong when use gpu?
apache/mxnet#8963

figure out ,nd.ones() must init on gpu