class_docstr: Expectation Maximization Attention Networks for Semantic Segmentation.
  
  This head is the implementation of `EMANet
  <https://arxiv.org/abs/1907.13426>`_.
  
  Args:
      ema_channels (int): EMA module channels
      num_bases (int): Number of bases.
      num_stages (int): Number of the EM iterations.
      concat_input (bool): Whether concat the input and output of convs
          before classification layer. Default: True
      momentum (float): Momentum to update the base. Default: 0.1.
class_docstr_tok: ["Expectation","Maximization","Attention","Networks","for","Semantic","Segmentation",".","This","head","is","the","implementation","of","`","EMANet","<","https",":","\/\/arxiv.org\/abs\/1907.13426",">","`","_",".","Args",":","ema_channels","(","int",")",":","EMA","module","channels","num_bases","(","int",")",":","Number","of","bases",".","num_stages","(","int",")",":","Number","of","the","EM","iterations",".","concat_input","(","bool",")",":","Whether","concat","the","input","and","output","of","convs","before","classification","layer",".","Default",":","True","momentum","(","float",")",":","Momentum","to","update","the","base",".","Default",":","0.1","."]
docstr: Forward function.
docstr_tok: ["Forward","function","."]
code: def forward(self, inputs):
      """Forward function."""
      x = self._transform_inputs(inputs)
      feats = self.ema_in_conv(x)
      identity = feats
      feats = self.ema_mid_conv(feats)
      recon = self.ema_module(feats)
      recon = F.relu(recon, inplace=True)
      recon = self.ema_out_conv(recon)
      output = F.relu(identity + recon, inplace=True)
      output = self.bottleneck(output)
      if self.concat_input:
          output = self.conv_cat(torch.cat([x, output], dim=1))
      output = self.cls_seg(output)
      return output
  
file_path: lavis/lavis/common/annotator/uniformer/mmseg/models/decode_heads/ema_head.py
imports: import math
  import torch
  import torch.distributed
  import torch.nn
  import torch.nn.functional
  from annotator.uniformer.mmcv.cnn import ConvModule
  from ..builder import HEADS
  from .decode_head import BaseDecodeHead
label_desc: Use image node_id 2 for calling the EMAHead obj's underlying member method code with example usage: obj.forward(inputs) and returns: output