class_docstr: Ensemble class that uses bagging for ensembling intent-slot models.
  
  Args:
      config (Config): Configuration object specifying all the
          parameters of BaggingIntentSlotEnsemble.
      models (List[Model]): List of intent-slot model objects.
  
  Attributes:
      use_crf (bool): Whether to use CRF for word tagging task.
      output_layer (IntentSlotOutputLayer): Output layer of intent-slot
          model responsible for computing loss and predictions.
docstr: Merges all sub-models' transition matrices when using CRF.
  Otherwise does nothing.
docstr_tok: ["Merges","all","sub-models","'","transition","matrices","when","using","CRF",".","Otherwise","does","nothing","."]
code: def merge_sub_models(self) -> None:
      """Merges all sub-models' transition matrices when using CRF.
      Otherwise does nothing.
      """
      # to get the transition_matrix for the ensemble model, we average the
      # transition matrices of the children model
      if not self.use_crf:
          return
      transition_matrix = torch.mean(
          torch.cat(
              tuple(
                  model.output_layer.word_output.crf.get_transitions().unsqueeze(
                      0
                  )
                  for model in self.models
              ),
              dim=0,
          ),
          dim=0,
      )
      self.output_layer.word_output.crf.set_transitions(
          transition_matrix
      )
  
file_path: pytext/pytext/models/ensembles/bagging_intent_slot_ensemble.py
imports: from typing import Dict, List, Tuple
  import torch
  from pytext.models.joint_model import IntentSlotModel
  from pytext.models.model import Model
  from pytext.models.output_layers import CRFOutputLayer
  from pytext.utils.usage import log_class_usage
  from .ensemble import EnsembleModel
label_desc: Use image node_id 2 for calling the BaggingIntentSlotEnsembleModel obj's underlying member method code with example usage: obj.merge_sub_models() without return types