class_docstr: BAT
  Adapted from: https://github.com/BA-Transform/BAT-Image-Classification
class_docstr_tok: ["BAT","Adapted","from",":","https",":","\/\/github.com\/BA-Transform\/BAT-Image-Classification"]
code: def __init__(
      self,
      in_channels,
      block_size=7,
      groups=2,
      rd_ratio=0.25,
      rd_channels=None,
      rd_divisor=8,
      drop_rate=0.2,
      act_layer=nn.ReLU,
      norm_layer=nn.BatchNorm2d,
      **_,
  ):
      super().__init__()
      if rd_channels is None:
          rd_channels = make_divisible(
              in_channels * rd_ratio, divisor=rd_divisor
          )
      self.conv1 = ConvNormAct(
          in_channels,
          rd_channels,
          1,
          act_layer=act_layer,
          norm_layer=norm_layer,
      )
      self.ba = BilinearAttnTransform(
          rd_channels,
          block_size,
          groups,
          act_layer=act_layer,
          norm_layer=norm_layer,
      )
      self.conv2 = ConvNormAct(
          rd_channels,
          in_channels,
          1,
          act_layer=act_layer,
          norm_layer=norm_layer,
      )
      self.dropout = nn.Dropout2d(p=drop_rate)
  
file_path: pytorch-image-models/timm/layers/non_local_attn.py
imports: import torch
  from torch import nn
  from torch.nn import functional
  from .conv_bn_act import ConvNormAct
  from .helpers import make_divisible
  from .trace_utils import _assert
label_desc: Use image node_id 1 to create a new BatNonLocalAttn object from inherited base classes: nn with example: obj = BatNonLocalAttn(in_channels, block_size, groups, rd_ratio, rd_channels, rd_divisor, drop_rate, act_layer, norm_layer)