class_docstr: Dummy Generator that delegates to individual real Generators,
  and then averages the resulting target distributions.
docstr: Compute a distribution over the target dictionary
  by averaging distributions from models in the ensemble.
  All models in the ensemble must share a target vocabulary.
docstr_tok: ["Compute","a","distribution","over","the","target","dictionary","by","averaging","distributions","from","models","in","the","ensemble",".","All","models","in","the","ensemble","must","share","a","target","vocabulary","."]
code: def forward(self, hidden, attn=None, src_map=None):
      """
      Compute a distribution over the target dictionary
      by averaging distributions from models in the ensemble.
      All models in the ensemble must share a target vocabulary.
      """
      distributions = torch.stack(
          [
              mg(h) if attn is None else mg(h, attn, src_map)
              for h, mg in zip(hidden, self.model_generators)
          ]
      )
      if self._raw_probs:
          return torch.log(torch.exp(distributions).mean(0))
      else:
          return distributions.mean(0)
  
imports: import torch
  import torch.nn
  from onmt.encoders.encoder import EncoderBase
  from onmt.decoders.decoder import DecoderBase
  from onmt.models import NMTModel
  import onmt.model_builder
label_desc: Use image node_id 2 for calling the EnsembleGenerator obj's underlying member method code with example usage: obj.forward(hidden, attn, src_map) and returns: torch, distributions