File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -172,13 +172,14 @@ Using Theano, it gives::
172172
173173 # nv :: size of our vocabulary
174174 # de :: dimension of the embedding space
175- nv, de = 1000, 50
175+ # cs :: context window size
176+ nv, de, cs = 1000, 50, 5
176177
177178 embeddings = theano.shared(0.2 * numpy.random.uniform(-1.0, 1.0, \
178179 (nv+1, de)).astype(theano.config.floatX)) # add one for PADDING at the end
179180
180181 idxs = T.imatrix() # as many columns as words in the context window and as many lines as words in the sentence
181- x, _ = theano.scan(fn=lambda idx: embeddings[idx].flatten(), sequences=idxs )
182+ x = self.emb[idxs].reshape((idxs.shape[0], de*cs) )
182183
183184The x symbolic variable corresponds to a matrix of shape (number of words in the
184185sentences, dimension of the embedding space X context window size).
You can’t perform that action at this time.
0 commit comments