code: def forward(self, net: Tensor) -> Tensor:
      inp = net
      net = self.norm(net)
      q = self.q(net)
      k = self.k(net)
      v = self.v(net)
  
      b, c, h, w = q.shape
      q = q.reshape(b, c, h * w)
      q = q.permute(0, 2, 1)
      k = k.reshape(b, c, h * w)
      weights = torch.bmm(q, k)
      weights = weights * (int(c) ** (-0.5))
      weights = torch.nn.functional.softmax(weights, dim=2)
  
      v = v.reshape(b, c, h * w)
      weights = weights.permute(0, 2, 1)
      net = torch.bmm(v, weights)
      net = net.reshape(b, c, h, w)
      net = self.proj_out(net)
      return inp + net
  
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 2 for calling the AttnBlock obj's underlying member method code with example usage: obj.forward(net) and returns: unknown