class_docstr: Window based multi-head self attention (W-MSA) module with relative position bias.
  It supports both of shifted and non-shifted window.
  
  Args:
      dim (int): Number of input channels.
      window_size (tuple[int]): The height and width of the window.
      num_heads (int): Number of attention heads.
      qkv_bias (bool, optional):  If True, add a learnable bias to query, key, value. Default: True
      qk_scale (float | None, optional): Override default query and key scale of head_dim ** -0.5 if set. Default None
      attn_drop (float, optional): Dropout ratio of attention weight. Default: 0.0
      proj_drop (float, optional): Dropout ratio of output. Default: 0.0
class_docstr_tok: ["Window","based","multi-head","self","attention","(","W-MSA",")","module","with","relative","position","bias",".","It","supports","both","of","shifted","and","non-shifted","window",".","Args",":","dim","(","int",")",":","Number","of","input","channels",".","window_size","(","tuple","[","int","]",")",":","The","height","and","width","of","the","window",".","num_heads","(","int",")",":","Number","of","attention","heads",".","qkv_bias","(","bool",",","optional",")",":","If","True",",","add","a","learnable","bias","to","query",",","key",",","value",".","Default",":","True","qk_scale","(","float","|","None",",","optional",")",":","Override","default","query","and","key","scale","of","head_dim","*","*","-0.5","if","set",".","Default","None","attn_drop","(","float",",","optional",")",":","Dropout","ratio","of","attention","weight",".","Default",":","0.0","proj_drop","(","float",",","optional",")",":","Dropout","ratio","of","output",".","Default",":","0.0"]
code: def eval(self):
      super().eval()
      # this is used to re-param swin for model export
      relative_position_bias_table = self.relative_position_bias_table
      window_size = self.window_size
      index = self.relative_position_index.reshape([-1])
  
      relative_position_bias = paddle.index_select(
          relative_position_bias_table, index
      )
      relative_position_bias = relative_position_bias.reshape(
          [
              window_size[0] * window_size[1],
              window_size[0] * window_size[1],
              -1,
          ]
      )  # Wh*Ww,Wh*Ww,nH
      relative_position_bias = relative_position_bias.transpose(
          [2, 0, 1]
      )  # nH, Wh*Ww, Wh*Ww
      relative_position_bias = relative_position_bias.unsqueeze(0)
      self.register_buffer(
          "relative_position_bias", relative_position_bias
      )
  
imports: import numpy
  import paddle
  import paddle.nn
  from medicalseg.cvlibs import manager, param_init
  from medicalseg.utils import load_pretrained_model
  from medicalseg.models.backbones.transformer_utils import DropPath, to_2tuple
label_desc: Use image node_id 2 for calling the WindowAttention obj's underlying member method code with example usage: obj.eval() without return types