class_docstr: Window based multi-head self attention module with relative position bias based on: "Liu et al.,
  Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  <https://arxiv.org/abs/2103.14030>"
  https://github.com/microsoft/Swin-Transformer
code: def forward(self, x, mask):
      b, n, c = x.shape
      qkv = (
          self.qkv(x)
          .reshape(b, n, 3, self.num_heads, c // self.num_heads)
          .permute(2, 0, 3, 1, 4)
      )
      q, k, v = qkv[0], qkv[1], qkv[2]
      q = q * self.scale
      attn = q @ k.transpose(-2, -1)
      relative_position_bias = self.relative_position_bias_table[
          self.relative_position_index.clone()[:n, :n].reshape(-1)
      ].reshape(n, n, -1)
      relative_position_bias = relative_position_bias.permute(
          2, 0, 1
      ).contiguous()
      attn = attn + relative_position_bias.unsqueeze(0)
      if mask is not None:
          nw = mask.shape[0]
          attn = attn.view(
              b // nw, nw, self.num_heads, n, n
          ) + mask.unsqueeze(1).unsqueeze(0)
          attn = attn.view(-1, self.num_heads, n, n)
          attn = self.softmax(attn)
      else:
          attn = self.softmax(attn)
  
      attn = self.attn_drop(attn).to(v.dtype)
      x = (attn @ v).transpose(1, 2).reshape(b, n, c)
      x = self.proj(x)
      x = self.proj_drop(x)
      return x
  
imports: from __future__ import annotations
  import itertools
  from collections.abc import Sequence
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from torch.nn import LayerNorm
  from typing_extensions import Final
  from monai.networks.blocks import MLPBlock
  from monai.networks.blocks import PatchEmbed, UnetOutBlock, UnetrBasicBlock, UnetrUpBlock
  from monai.networks.layers import DropPath, trunc_normal_
  from monai.utils import ensure_tuple_rep, look_up_option, optional_import
  from monai.utils.deprecate_utils import deprecated_arg
label_desc: Use image node_id 2 for calling the WindowAttention obj's underlying member method code with example usage: obj.forward(x, mask) and returns: x