class_docstr: GCAModule in MASTER.
  
  Args:
      in_channels (int): Channels of input tensor.
      ratio (float): Scale ratio of in_channels.
      n_head (int): Numbers of attention head.
      pooling_type (str): Spatial pooling type. Options are [``avg``,
          ``att``].
      scale_attn (bool): Whether to scale the attention map. Defaults to
          False.
      fusion_type (str): Fusion type of input and context. Options are
          [``channel_add``, ``channel_mul``, ``channel_concat``].
class_docstr_tok: ["GCAModule","in","MASTER",".","Args",":","in_channels","(","int",")",":","Channels","of","input","tensor",".","ratio","(","float",")",":","Scale","ratio","of","in_channels",".","n_head","(","int",")",":","Numbers","of","attention","head",".","pooling_type","(","str",")",":","Spatial","pooling","type",".","Options","are","[","``","avg","``",",","``","att","``","]",".","scale_attn","(","bool",")",":","Whether","to","scale","the","attention","map",".","Defaults","to","False",".","fusion_type","(","str",")",":","Fusion","type","of","input","and","context",".","Options","are","[","``","channel_add","``",",","``","channel_mul","``",",","``","channel_concat","``","]","."]
docstr: Forward function.
  
  Args:
      x (Tensor): Input feature map.
  
  Returns:
      Tensor: Output tensor after GCAModule.
docstr_tok: ["Forward","function",".","Args",":","x","(","Tensor",")",":","Input","feature","map",".","Returns",":","Tensor",":","Output","tensor","after","GCAModule","."]
code: def forward(self, x: torch.Tensor) -> torch.Tensor:
      """Forward function.
  
      Args:
          x (Tensor): Input feature map.
  
      Returns:
          Tensor: Output tensor after GCAModule.
      """
      # [N, C, 1, 1]
      context = self.spatial_pool(x)
      out = x
  
      if self.fusion_type == "channel_mul":
          # [N, C, 1, 1]
          channel_mul_term = torch.sigmoid(
              self.channel_mul_conv(context)
          )
          out = out * channel_mul_term
      elif self.fusion_type == "channel_add":
          # [N, C, 1, 1]
          channel_add_term = self.channel_add_conv(context)
          out = out + channel_add_term
      else:
          # [N, C, 1, 1]
          channel_concat_term = self.channel_concat_conv(context)
  
          # use concat
          _, C1, _, _ = channel_concat_term.shape
          N, C2, H, W = out.shape
  
          out = torch.cat(
              [out, channel_concat_term.expand(-1, -1, H, W)], dim=1
          )
          out = self.cat_conv(out)
          out = nn.functional.layer_norm(out, [self.in_channels, H, W])
          out = nn.functional.relu(out)
  
      return out
  
file_path: mmocr/mmocr/models/textrecog/plugins/common.py
imports: from typing import Tuple, Union
  import torch
  import torch.nn
  from mmocr.registry import MODELS
label_desc: Use image node_id 3 for calling the GCAModule obj's underlying member method code with example usage: obj.forward(x) and returns: out