def translate(self, src_seq, src_valid_length):
batch_size = src_seq.shape[<NUM_LIT:0>]<EOL>encoder_outputs, _ = self._model.encode(src_seq, valid_length=src_valid_length)<EOL>decoder_states = self._model.decoder.init_state_from_encoder(encoder_outputs,<EOL>src_valid_length)<EOL>inputs = mx.nd.full(shape=(batch_size,), ctx=src_seq.context, dtype=np.float32,<EOL>val=self._model.tgt_vocab.token_to_idx[self._model.tgt_vocab.bos_token])<EOL>samples, scores, sample_valid_length = self._sampler(inputs, decoder_states)<EOL>return samples, scores, sample_valid_length<EOL>
Get the translation result given the input sentence.

        Parameters
        ----------
        src_seq : mx.nd.NDArray
            Shape (batch_size, length)
        src_valid_length : mx.nd.NDArray
            Shape (batch_size,)

        Returns
        -------
        samples : NDArray
            Samples draw by beam search. Shape (batch_size, beam_size, length). dtype is int32.
        scores : NDArray
            Scores of the samples. Shape (batch_size, beam_size). We make sure that scores[i, :] are
            in descending order.
        valid_length : NDArray
            The valid length of the samples. Shape (batch_size, beam_size). dtype will be int32.