class_docstr: ## Attention block
docstr: :param channels: is the number of channels
code: def __init__(self, channels: int):
      """
      :param channels: is the number of channels
      """
      super().__init__()
      # Group normalization
      self.norm = normalization(channels)
      # Query, key and value mappings
      self.q = nn.Conv2d(channels, channels, 1)
      self.k = nn.Conv2d(channels, channels, 1)
      self.v = nn.Conv2d(channels, channels, 1)
      # Final $1 \times 1$ convolution layer
      self.proj_out = nn.Conv2d(channels, channels, 1)
      # Attention scaling factor
      self.scale = channels**-0.5
  
imports: from typing import List
  import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 1 to create a new AttnBlock object from inherited base classes: nn with example: obj = AttnBlock(channels)