class_docstr: Gather-Excite Attention Module
      
class_docstr_tok: ["Gather-Excite","Attention","Module"]
code: def forward(self, x):
      size = x.shape[-2:]
      if self.gather is not None:
          x_ge = self.gather(x)
      else:
          if self.extent == 0:
              # global extent
              x_ge = x.mean(dim=(2, 3), keepdims=True)
              if self.add_maxpool:
                  # experimental codepath, may remove or change
                  x_ge = 0.5 * x_ge + 0.5 * x.amax((2, 3), keepdim=True)
          else:
              x_ge = F.avg_pool2d(
                  x,
                  kernel_size=self.gk,
                  stride=self.gs,
                  padding=self.gk // 2,
                  count_include_pad=False,
              )
              if self.add_maxpool:
                  # experimental codepath, may remove or change
                  x_ge = 0.5 * x_ge + 0.5 * F.max_pool2d(
                      x,
                      kernel_size=self.gk,
                      stride=self.gs,
                      padding=self.gk // 2,
                  )
      x_ge = self.mlp(x_ge)
      if x_ge.shape[-1] != 1 or x_ge.shape[-2] != 1:
          x_ge = F.interpolate(x_ge, size=size)
      return x * self.gate(x_ge)
  
file_path: pytorch-image-models/timm/layers/gather_excite.py
imports: import math
  from torch import nn
  import torch.nn.functional
  from .create_act import create_act_layer, get_act_layer
  from .create_conv2d import create_conv2d
  from .helpers import make_divisible
  from .mlp import ConvMlp
label_desc: Use image node_id 2 for calling the GatherExcite obj's underlying member method code with example usage: obj.forward(x) and returns: unknown