class_docstr: Parallel block class. 
class_docstr_tok: ["Parallel","block","class","."]
code: def __init__(
      self,
      dims,
      num_heads,
      mlp_ratios=[],
      qkv_bias=False,
      proj_drop=0.0,
      attn_drop=0.0,
      drop_path=0.0,
      act_layer=nn.GELU,
      norm_layer=nn.LayerNorm,
      shared_crpes=None,
  ):
      super().__init__()
  
      # Conv-Attention.
      self.norm12 = norm_layer(dims[1])
      self.norm13 = norm_layer(dims[2])
      self.norm14 = norm_layer(dims[3])
      self.factoratt_crpe2 = FactorAttnConvRelPosEnc(
          dims[1],
          num_heads=num_heads,
          qkv_bias=qkv_bias,
          attn_drop=attn_drop,
          proj_drop=proj_drop,
          shared_crpe=shared_crpes[1],
      )
      self.factoratt_crpe3 = FactorAttnConvRelPosEnc(
          dims[2],
          num_heads=num_heads,
          qkv_bias=qkv_bias,
          attn_drop=attn_drop,
          proj_drop=proj_drop,
          shared_crpe=shared_crpes[2],
      )
      self.factoratt_crpe4 = FactorAttnConvRelPosEnc(
          dims[3],
          num_heads=num_heads,
          qkv_bias=qkv_bias,
          attn_drop=attn_drop,
          proj_drop=proj_drop,
          shared_crpe=shared_crpes[3],
      )
      self.drop_path = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
  
      # MLP.
      self.norm22 = norm_layer(dims[1])
      self.norm23 = norm_layer(dims[2])
      self.norm24 = norm_layer(dims[3])
      # In parallel block, we assume dimensions are the same and share the linear transformation.
      assert dims[1] == dims[2] == dims[3]
      assert mlp_ratios[1] == mlp_ratios[2] == mlp_ratios[3]
      mlp_hidden_dim = int(dims[1] * mlp_ratios[1])
      self.mlp2 = self.mlp3 = self.mlp4 = Mlp(
          in_features=dims[1],
          hidden_features=mlp_hidden_dim,
          act_layer=act_layer,
          drop=proj_drop,
      )
  
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 ParallelBlock object from inherited base classes: nn with example: obj = ParallelBlock(dims, num_heads, mlp_ratios, qkv_bias, proj_drop, attn_drop, drop_path, act_layer, norm_layer, shared_crpes)