def __call__(self, corpus):
if self._last_batch == '<STR_LIT>':<EOL><INDENT>coded = self._vocab[list(corpus)]<EOL>sample_len = math.ceil(float(len(coded)) / self._batch_size)<EOL>padding_size = _slice_pad_length(sample_len, self._seq_len + <NUM_LIT:1>, <NUM_LIT:1>) *self._batch_size + sample_len * self._batch_size - len(coded)<EOL>coded.extend([self._vocab[self._vocab.padding_token]] * int(padding_size))<EOL>assert len(coded) % self._batch_size == <NUM_LIT:0><EOL>assert not _slice_pad_length(len(coded) / self._batch_size, self._seq_len + <NUM_LIT:1>, <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>sample_len = len(corpus) // self._batch_size<EOL>coded = self._vocab[corpus[:sample_len * self._batch_size]]<EOL><DEDENT>data = mx.nd.array(coded).reshape((self._batch_size, -<NUM_LIT:1>)).T<EOL>batches = slice_sequence(data, self._seq_len + <NUM_LIT:1>, overlap=<NUM_LIT:1>)<EOL>return SimpleDataset(batches).transform(_split_data_label, lazy=False)<EOL>
Batchify a dataset.

        Parameters
        ----------
        corpus : mxnet.gluon.data.Dataset
            A flat dataset to be batchified.

        Returns
        -------
        mxnet.gluon.data.Dataset
            Batches of numericalized samples such that the recurrent states
            from last batch connects with the current batch for each sample.
            Each element of the Dataset is a tuple of data and label arrays for
            BPTT. They are of shape (seq_len, batch_size) respectively.