class_docstr: Builds a component pipeline from heterogeneous components (Rule-based/ML/DL). It allows to train
  and infer models in a pipeline as a whole.
  
  Attributes:
      pipe: list of components and their input and output variable names for inference
      train_pipe: list of components and their input and output variable names for training and evaluation
      in_x: names of inputs for pipeline inference mode
      out_params: names of pipeline inference outputs
      in_y: names of additional inputs for pipeline training and evaluation modes
      forward_map: list of all variables in chainer's memory after  running every component in ``self.pipe``
      train_map: list of all variables in chainer's memory after  running every component in ``train_pipe.pipe``
      main: reference to the main component
  
  Args:
      in_x: names of inputs for pipeline inference mode
      out_params: names of pipeline inference outputs
      in_y: names of additional inputs for pipeline training and evaluation modes
class_docstr_tok: ["Builds","a","component","pipeline","from","heterogeneous","components","(","Rule-based\/ML\/DL",")",".","It","allows","to","train","and","infer","models","in","a","pipeline","as","a","whole",".","Attributes",":","pipe",":","list","of","components","and","their","input","and","output","variable","names","for","inference","train_pipe",":","list","of","components","and","their","input","and","output","variable","names","for","training","and","evaluation","in_x",":","names","of","inputs","for","pipeline","inference","mode","out_params",":","names","of","pipeline","inference","outputs","in_y",":","names","of","additional","inputs","for","pipeline","training","and","evaluation","modes","forward_map",":","list","of","all","variables","in","chainer","'s","memory","after","running","every","component","in","``","self.pipe","``","train_map",":","list","of","all","variables","in","chainer","'s","memory","after","running","every","component","in","``","train_pipe.pipe","``","main",":","reference","to","the","main","component","Args",":","in_x",":","names","of","inputs","for","pipeline","inference","mode","out_params",":","names","of","pipeline","inference","outputs","in_y",":","names","of","additional","inputs","for","pipeline","training","and","evaluation","modes"]
docstr: 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.
docstr_tok: ["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","."]
code: 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
  
imports: import pickle
  from itertools import islice
  from logging import getLogger
  from types import FunctionType
  from typing import Union, Tuple, List, Optional, Hashable, Reversible
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.models.component import Component
  from deeppavlov.core.models.nn_model import NNModel
  from deeppavlov.core.models.serializable import Serializable
label_desc: Use image node_id 10 for calling the Chainer obj's underlying member method code with example usage: obj.batched_call() and returns: answer