code: def __init__(
      self,
      dim,
      heads=8,
      dim_key=32,
      dim_value=32,
      dropout=0.0,
      reduction_factor=1,
  ):
      super().__init__()
      self.heads = heads
      self.scale = dim_key**-0.5
      self.attend = nn.Softmax(dim=-1)
      self.dropout = nn.Dropout(dropout)
  
      self.norm = ChanLayerNorm(dim)
      self.to_q = nn.Conv2d(dim, dim_key * heads, 1, bias=False)
      self.to_k = nn.Conv2d(
          dim,
          dim_key * heads,
          reduction_factor,
          stride=reduction_factor,
          bias=False,
      )
      self.to_v = nn.Conv2d(
          dim,
          dim_value * heads,
          reduction_factor,
          stride=reduction_factor,
          bias=False,
      )
  
      self.to_out = nn.Sequential(
          nn.Conv2d(dim_value * heads, dim, 1), nn.Dropout(dropout)
      )
  
imports: from functools import partial
  import torch
  from torch import nn
  from einops import rearrange, repeat
  from einops.layers.torch import Rearrange, Reduce
label_desc: Use image node_id 1 to create a new ScalableSelfAttention object from inherited base classes: nn with example: obj = ScalableSelfAttention(dim, heads, dim_key, dim_value, dropout, reduction_factor)