class_docstr: Factorized attention with convolutional relative position encoding class. 
class_docstr_tok: ["Factorized","attention","with","convolutional","relative","position","encoding","class","."]
code: def __init__(
      self,
      dim,
      num_heads=8,
      qkv_bias=False,
      attn_drop=0.0,
      proj_drop=0.0,
      shared_crpe=None,
  ):
      super().__init__()
      self.num_heads = num_heads
      head_dim = dim // num_heads
      self.scale = head_dim**-0.5
  
      self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
      self.attn_drop = nn.Dropout(
          attn_drop
      )  # Note: attn_drop is actually not used.
      self.proj = nn.Linear(dim, dim)
      self.proj_drop = nn.Dropout(proj_drop)
  
      # Shared convolutional relative position encoding.
      self.crpe = shared_crpe
  
imports: from functools import partial
  from typing import Tuple, List, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import PatchEmbed, Mlp, DropPath, to_2tuple, trunc_normal_, _assert, LayerNorm
  from ._builder import build_model_with_cfg
  from ._registry import register_model, generate_default_cfgs
label_desc: Use image node_id 1 to create a new FactorAttnConvRelPosEnc object from inherited base classes: nn with example: obj = FactorAttnConvRelPosEnc(dim, num_heads, qkv_bias, attn_drop, proj_drop, shared_crpe)