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"]
code: def get_main_component(self) -> Optional[Serializable]:
      try:
          return self.main or self.pipe[-1][-1]
      except IndexError:
          log.warning(
              "Cannot get a main component for an empty chainer"
          )
          return None
  
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 11 for calling the Chainer obj's underlying member method code with example usage: obj.get_main_component() and returns: unknown, None