code: def hybrid_forward(self, F, scores, offset):
          
          # Shape: (batch size, beam_size * vocab_size)
          folded_scores = F.reshape(scores, shape=(-1, self.k * self.vocab_size))
  
          values, indices = F.topk(folded_scores, axis=1, k=self.k, ret_typ='both', is_ascend=True)
  
          # Project indices back into original shape (which is different for t==1 and t>1)
          indices = F.reshape(F.cast(indices, 'int32'), shape=(-1,))
          # TODO: we currently exploit a bug in the implementation of unravel_index to not require knowing the first shape
          # value. See https://github.com/apache/incubator-mxnet/issues/13862
          unraveled = F.unravel_index(indices, shape=(C.LARGEST_INT, self.vocab_size))
  
          best_hyp_indices, best_word_indices = F.split(unraveled, axis=0, num_outputs=2, squeeze_axis=True)
          best_hyp_indices = best_hyp_indices + offset
          values = F.reshape(values, shape=(-1, 1))
          return best_hyp_indices, best_word_indices, values
docs: Get the lowest k elements per sentence from a `scores` matrix.
  
          :param scores: Vocabulary scores for the next beam step. (batch_size * beam_size, target_vocabulary_size)
          :param offset: Array to add to the hypothesis indices for offsetting in batch decoding.
          :return: The row indices, column indices and values of the k smallest items in matrix.