class_docstr: Implements the Multi-Aspect Global Context Attention, as described in
  <https://arxiv.org/pdf/1910.02562.pdf>`_.
  
  Args:
  ----
      inplanes: input channels
      headers: number of headers to split channels
      attn_scale: if True, re-scale attention to counteract the variance distibutions
      ratio: bottleneck ratio
      **kwargs
class_docstr_tok: ["Implements","the","Multi-Aspect","Global","Context","Attention",",","as","described","in","<","https",":","\/\/arxiv.org\/pdf\/1910.02562.pdf",">","`","_",".","Args",":","--","--","inplanes",":","input","channels","headers",":","number","of","headers","to","split","channels","attn_scale",":","if","True",",","re-scale","attention","to","counteract","the","variance","distibutions","ratio",":","bottleneck","ratio","*","*","kwargs"]
code: def forward(self, inputs: torch.Tensor) -> torch.Tensor:
      batch, _, height, width = inputs.size()
      # (N * headers, C / headers, H , W)
      x = inputs.view(
          batch * self.headers,
          self.single_header_inplanes,
          height,
          width,
      )
      shortcut = x
      # (N * headers, C / headers, H * W)
      shortcut = shortcut.view(
          batch * self.headers,
          self.single_header_inplanes,
          height * width,
      )
  
      # (N * headers, 1, H, W)
      context_mask = self.conv_mask(x)
      # (N * headers, H * W)
      context_mask = context_mask.view(batch * self.headers, -1)
  
      # scale variance
      if self.attn_scale and self.headers > 1:
          context_mask = context_mask / math.sqrt(
              self.single_header_inplanes
          )
  
      # (N * headers, H * W)
      context_mask = self.softmax(context_mask)
  
      # (N * headers, C / headers)
      context = (shortcut * context_mask.unsqueeze(1)).sum(-1)
  
      # (N, C, 1, 1)
      context = context.view(
          batch, self.headers * self.single_header_inplanes, 1, 1
      )
  
      # Transform: B, C, 1, 1 ->  B, C, 1, 1
      transformed = self.transform(context)
      return inputs + transformed
  
file_path: doctr/doctr/models/classification/magc_resnet/pytorch.py
imports: import math
  from copy import deepcopy
  from functools import partial
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from torch import nn
  from doctr.datasets import VOCABS
  from ...utils.pytorch import load_pretrained_params
  from ..resnet.pytorch import ResNet
label_desc: Use image node_id 2 for calling the MAGC obj's underlying member method code with example usage: obj.forward(inputs) and returns: unknown