diff --git a/HiddenMarkovModel.py b/HiddenMarkovModel.py index 31b74c0..67b58d6 100644 --- a/HiddenMarkovModel.py +++ b/HiddenMarkovModel.py @@ -189,7 +189,7 @@ def _backward(self, obs_prob_list): # Update backward matrix self.backward = tf.scatter_update(self.backward, step+1, self.scale[self.N-2-step] * backward_prob) - self.backward = tf.assign(self.backward, tf.reverse(self.backward, [True, False])) + self.backward = tf.assign(self.backward, tf.reverse(self.backward, [0])) def _posterior(self): @@ -277,7 +277,7 @@ def forward_backward(self, obs_prob_seq): # forward belief propagation self._forward(obs_prob_list_for) - obs_prob_seq_rev = tf.reverse(obs_prob_seq, [True, False]) + obs_prob_seq_rev = tf.reverse(obs_prob_seq, [0]) obs_prob_list_back = tf.split(obs_prob_seq_rev, self.N, 0) with tf.name_scope('backward_belief_propagation'):