class_docstr: The basic implementation for pyramid self-attention block/non-local block
class_docstr_tok: ["The","basic","implementation","for","pyramid","self-attention","block\/non-local","block"]
code: def __init__(
      self,
      in_channels,
      out_channels,
      key_channels,
      value_channels,
      scale=1,
      norm_layer=nn.BatchNorm2d,
      **kwargs,
  ):
      super(PyramidAttentionBlock, self).__init__()
      self.scale = scale
      self.value_channels = value_channels
      self.key_channels = key_channels
  
      self.f_value = nn.Conv2d(in_channels, value_channels, 1)
      self.f_key = nn.Sequential(
          nn.Conv2d(in_channels, key_channels, 1),
          norm_layer(key_channels),
          nn.ReLU(True),
      )
      self.f_query = self.f_key
      self.W = nn.Conv2d(value_channels, out_channels, 1)
      nn.init.constant_(self.W.weight, 0)
      nn.init.constant_(self.W.bias, 0)
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from pywick.models.segmentation.da_basenets.segbase import SegBaseModel
  from pywick.models.segmentation.da_basenets.fcn import _FCNHead
label_desc: Use image node_id 1 to create a new PyramidAttentionBlock object from inherited base classes: nn with example: obj = PyramidAttentionBlock(in_channels, out_channels, key_channels, value_channels, scale, norm_layer)