class_docstr: This is much like `.vision_transformer.Attention` but uses *localised* self attention by accepting an input with
   an extra "image block" dim
class_docstr_tok: ["This","is","much","like","`",".vision_transformer.Attention","`","but","uses","*","localised","*","self","attention","by","accepting","an","input","with","an","extra","``","image","block","''","dim"]
docstr: x is shape: B (batch_size), T (image blocks), N (seq length per image block), C (embed dim)
code: def forward(self, x):
      """
      x is shape: B (batch_size), T (image blocks), N (seq length per image block), C (embed dim)
      """
      B, T, N, C = x.shape
      # result of next line is (qkv, B, num (H)eads, T, N, (C')hannels per head)
      qkv = (
          self.qkv(x)
          .reshape(B, T, N, 3, self.num_heads, C // self.num_heads)
          .permute(3, 0, 4, 1, 2, 5)
      )
      q, k, v = qkv.unbind(
          0
      )  # make torchscript happy (cannot use tensor as tuple)
  
      if self.fused_attn:
          x = F.scaled_dot_product_attention(
              q,
              k,
              v,
              dropout_p=self.attn_drop.p if self.training else 0.0,
          )
      else:
          q = q * self.scale
          attn = q @ k.transpose(-2, -1)  # (B, H, T, N, N)
          attn = attn.softmax(dim=-1)
          attn = self.attn_drop(attn)
          x = attn @ v
  
      # (B, H, T, N, C'), permute -> (B, T, N, C', H)
      x = x.permute(0, 2, 3, 4, 1).reshape(B, T, N, C)
      x = self.proj(x)
      x = self.proj_drop(x)
      return x
  
imports: import collections.abc
  import logging
  import math
  from functools import partial
  import torch
  import torch.nn.functional
  from torch import nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import PatchEmbed, Mlp, DropPath, create_classifier, trunc_normal_, _assert
  from timm.layers import create_conv2d, create_pool2d, to_ntuple, use_fused_attn, LayerNorm
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_function
  from ._manipulate import checkpoint_seq, named_apply
  from ._registry import register_model, generate_default_cfgs, register_model_deprecations
label_desc: Use image node_id 2 for calling the Attention obj's underlying member method code with example usage: obj.forward(x) and returns: x