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::
172
172
173
173
# nv :: size of our vocabulary
174
174
# de :: dimension of the embedding space
175
- nv, de = 1000, 50
175
+ # cs :: context window size
176
+ nv, de, cs = 1000, 50, 5
176
177
177
178
embeddings = theano.shared(0.2 * numpy.random.uniform(-1.0, 1.0, \
178
179
(nv+1, de)).astype(theano.config.floatX)) # add one for PADDING at the end
179
180
180
181
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) )
182
183
183
184
The x symbolic variable corresponds to a matrix of shape (number of words in the
184
185
sentences, dimension of the embedding space X context window size).
You can’t perform that action at this time.
0 commit comments