From 8792dd327159b6eebbca167c325629b42e54766f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Simon?= Date: Thu, 23 Jul 2015 15:13:15 -0400 Subject: Fix bidirectional --- model/bidirectional.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model/bidirectional.py b/model/bidirectional.py index 149d1fd..af3891d 100644 --- a/model/bidirectional.py +++ b/model/bidirectional.py @@ -59,9 +59,10 @@ class BidiRNN(Initializable): longitude = tensor.shape_padright(longitude) rec_in = tensor.concatenate((latitude, longitude), axis=2) + last_id = tensor.cast(latitude_mask.sum(axis=0) - 1, dtype='int64') path = self.rec.apply(self.fork.apply(rec_in), mask=latitude_mask)[0] path_representation = (path[0][:, -self.config.hidden_state_dim:], - path[-1][:, :self.config.hidden_state_dim]) + path[last_id - 1, tensor.arange(latitude_mask.shape[1])][:, :self.config.hidden_state_dim]) embeddings = tuple(self.context_embedder.apply(**{k: kwargs[k] for k in self.context_embedder.inputs })) -- cgit v1.2.3