code: def __init__(
      self,
      channels,
      use_attn=True,
      fuse_add=False,
      fuse_scale=True,
      init_last_zero=False,
      rd_ratio=1.0 / 8,
      rd_channels=None,
      rd_divisor=1,
      act_layer=nn.ReLU,
      gate_layer="sigmoid",
  ):
      super(GlobalContext, self).__init__()
      act_layer = get_act_layer(act_layer)
  
      self.conv_attn = (
          nn.Conv2d(channels, 1, kernel_size=1, bias=True)
          if use_attn
          else None
      )
  
      if rd_channels is None:
          rd_channels = make_divisible(
              channels * rd_ratio, rd_divisor, round_limit=0.0
          )
      if fuse_add:
          self.mlp_add = ConvMlp(
              channels,
              rd_channels,
              act_layer=act_layer,
              norm_layer=LayerNorm2d,
          )
      else:
          self.mlp_add = None
      if fuse_scale:
          self.mlp_scale = ConvMlp(
              channels,
              rd_channels,
              act_layer=act_layer,
              norm_layer=LayerNorm2d,
          )
      else:
          self.mlp_scale = None
  
      self.gate = create_act_layer(gate_layer)
      self.init_last_zero = init_last_zero
      self.reset_parameters()
  
file_path: pytorch-image-models/timm/layers/global_context.py
imports: from torch import nn
  import torch.nn.functional
  from .create_act import create_act_layer, get_act_layer
  from .helpers import make_divisible
  from .mlp import ConvMlp
  from .norm import LayerNorm2d
label_desc: Use image node_id 1 to create a new GlobalContext object from inherited base classes: nn with example: obj = GlobalContext(channels, use_attn, fuse_add, fuse_scale, init_last_zero, rd_ratio, rd_channels, rd_divisor, act_layer, gate_layer)