diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/rnn.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/model/rnn.py b/model/rnn.py index bfc3122..0ee9586 100644 --- a/model/rnn.py +++ b/model/rnn.py @@ -99,7 +99,7 @@ class RNN(Initializable): res = self.predict_all(**kwargs)[0] last_id = tensor.cast(kwargs['latitude_mask'].sum(axis=0) - 1, dtype='int64') - return res[last_id] + return res[last_id, tensor.arange(kwargs['latitude_mask'].shape[1])] @predict.property('inputs') def predict_inputs(self): @@ -134,7 +134,7 @@ class RNN(Initializable): @application(outputs=['cost']) def valid_cost(self, **kwargs): last_id = tensor.cast(kwargs['latitude_mask'].sum(axis=1) - 1, dtype='int64') - return self.cost_matrix(**kwargs)[last_id].mean() + return self.cost_matrix(**kwargs)[last_id, tensor.arange(kwargs['latitude_mask'].shape[1])].mean() @valid_cost.property('inputs') def valid_cost_inputs(self): |