'Converts hidden state vectors into indices into the dictionary.'

def hidden_to_idx(self, hidden, dropout=False):

    if (hidden.size(0) > 1):
        raise RuntimeError('bad    dimensions    of    tensor:', hidden)
    hidden = hidden.squeeze(0)
    scores = self.h2o(hidden)
    if dropout:
        scores = self.dropout(scores)
    scores = self.softmax(scores)
    (_max_score, idx) = scores.max(1)
    return (idx, scores)
