def batched_call(self, *args: Reversible, batch_size: int = 16) -> Union[list, Tuple[list, ...]]:
        """
        Partitions data into mini-batches and applies :meth:`__call__` to each batch.

        Args:
            args: input data, each element of the data corresponds to a single model inputs sequence.
            batch_size: the size of a batch.

        Returns:
            the model output as if the data was passed to the :meth:`__call__` method.
        """
        args = [iter(arg) for arg in args]
        answer = [[] for _ in self.out_params]

        while True:
            batch = [list(islice(arg, batch_size)) for arg in args]
            if not any(batch):  # empty batch, reached the end
                break

            curr_answer = self.__call__(*batch)
            if len(self.out_params) == 1:
                curr_answer = [curr_answer]

            for y, curr_y in zip(answer, curr_answer):
                y.extend(curr_y)

        if len(self.out_params) == 1:
            answer = answer[0]
        return answer

        Partitions data into mini-batches and applies :meth:`__call__` to each batch.

        Args:
            args: input data, each element of the data corresponds to a single model inputs sequence.
            batch_size: the size of a batch.

        Returns:
            the model output as if the data was passed to the :meth:`__call__` method.
        
deeppavlov/core/common/chainer.py