class_docstr: See :func:`shifted_window_attention_v2`.
class_docstr_tok: ["See",":","func",":","`","shifted_window_attention_v2","`","."]
docstr: Args:
      x (Tensor): Tensor with layout of [B, H, W, C]
  Returns:
      Tensor with same layout as input, i.e. [B, H, W, C]
docstr_tok: ["Args",":","x","(","Tensor",")",":","Tensor","with","layout","of","[","B",",","H",",","W",",","C","]","Returns",":","Tensor","with","same","layout","as","input",",","i.e",".","[","B",",","H",",","W",",","C","]"]
code: def forward(self, x: Tensor):
      """
      Args:
          x (Tensor): Tensor with layout of [B, H, W, C]
      Returns:
          Tensor with same layout as input, i.e. [B, H, W, C]
      """
      relative_position_bias = self.get_relative_position_bias()
      return shifted_window_attention(
          x,
          self.qkv.weight,
          self.proj.weight,
          relative_position_bias,
          self.window_size,
          self.num_heads,
          shift_size=self.shift_size,
          attention_dropout=self.attention_dropout,
          dropout=self.dropout,
          qkv_bias=self.qkv.bias,
          proj_bias=self.proj.bias,
          logit_scale=self.logit_scale,
          training=self.training,
      )
  
imports: import math
  from functools import partial
  from typing import Any, Callable, List, Optional
  import torch
  import torch.nn.functional
  from torch import nn, Tensor
  from ..ops.misc import MLP, Permute
  from ..ops.stochastic_depth import StochasticDepth
  from ..transforms._presets import ImageClassification, InterpolationMode
  from ..utils import _log_api_usage_once
  from ._api import register_model, Weights, WeightsEnum
  from ._meta import _IMAGENET_CATEGORIES
  from ._utils import _ovewrite_named_param, handle_legacy_interface
label_desc: Use image node_id 4 for calling the ShiftedWindowAttentionV2 obj's underlying member method code with example usage: obj.forward(x) and returns: shifted_window_attention