I am not able to understand nn.LookupTable and its application

305 views
Skip to first unread message

saurabh vyas

unread,
Jun 24, 2017, 4:41:40 PM6/24/17
to torch7
I am a newbie here , I am not able to understand the need and use of lookuptable in torch , According to github ( torch 7 docs ) , It is a convolution layer of width 1 , what does that mean ?  What is the applications of lookuptable ?


Tasty Minerals

unread,
Jul 10, 2017, 4:50:31 PM7/10/17
to torch7
In simple terms, LookupTable transforms your vocab indices into tensors via convolution operation. For example, a train phrase "a green frog" will be represented in your data let's say as a set of numbers {1, 22, 15}. What LookupTable does is that it transforms each number into a n-dimensional tensor:

1 --> LookupTable --> [44 32 21 43 231]
22 --> LookupTable --> [2 12 94 12 33]
15 --> LookupTable --> [899 22 39 2 0]

This way, your neural network will be able to learn the tensors during backprop. You can get rid of LookupTable and use pretrained embeddings like word2vec or GloVe which already come as learned n-dimensional vectors.

saurabh vyas

unread,
Jul 12, 2017, 12:43:07 PM7/12/17
to torch7
Thank you very much , it was helpful .
Reply all
Reply to author
Forward
0 new messages