code: def __init__(self, dim: int):
      super().__init__()
      self.in_channels = dim
      self.norm = normalize(dim)
      self.q = Conv2d(dim, dim, kernel_size=1, stride=1, padding=0)
      self.k = Conv2d(dim, dim, kernel_size=1, stride=1, padding=0)
      self.v = Conv2d(dim, dim, kernel_size=1, stride=1, padding=0)
      self.proj_out = Conv2d(
          dim, dim, kernel_size=1, stride=1, padding=0
      )
  
imports: import torch
  import torch.nn
  from torch import Tensor
  from typing import List
  from typing import Optional
  from .schema import EncoderMixin
  from ....modules.blocks import Conv2d
label_desc: Use image node_id 1 to create a new AttnBlock object from inherited base classes: nn with example: obj = AttnBlock(dim)