def __init__(self, spacial_dim: int, embed_dim: int, num_heads_channels: int, output_dim: int=None):
    super().__init__()
    self.positional_embedding = nn.Parameter((th.randn(embed_dim, ((spacial_dim ** 2) + 1)) / (embed_dim ** 0.5)))
    self.qkv_proj = conv_nd(1, embed_dim, (3 * embed_dim), 1)
    self.c_proj = conv_nd(1, embed_dim, (output_dim or embed_dim), 1)
    self.num_heads = (embed_dim // num_heads_channels)
    self.attention = QKVAttention(self.num_heads)
def __init__(self, spacial_dim: int, embed_dim: int, num_heads_channels: int, output_dim: int=None):
    super().__init__()
    self.positional_embedding = nn.Parameter((th.randn(embed_dim, ((spacial_dim ** 2) + 1)) / (embed_dim ** 0.5)))
    self.qkv_proj = conv_nd(1, embed_dim, (3 * embed_dim), 1)
    self.c_proj = conv_nd(1, embed_dim, (output_dim or embed_dim), 1)
    self.num_heads = (embed_dim // num_heads_channels)
    self.attention = QKVAttention(self.num_heads)