class_docstr: Single hierarchical level of a Nested Transformer
      
class_docstr_tok: ["Single","hierarchical","level","of","a","Nested","Transformer"]
code: def __init__(
      self,
      num_blocks,
      block_size,
      seq_length,
      num_heads,
      depth,
      embed_dim,
      prev_embed_dim=None,
      mlp_ratio=4.0,
      qkv_bias=True,
      proj_drop=0.0,
      attn_drop=0.0,
      drop_path=[],
      norm_layer=None,
      act_layer=None,
      pad_type="",
  ):
      super().__init__()
      self.block_size = block_size
      self.grad_checkpointing = False
  
      self.pos_embed = nn.Parameter(
          torch.zeros(1, num_blocks, seq_length, embed_dim)
      )
  
      if prev_embed_dim is not None:
          self.pool = ConvPool(
              prev_embed_dim,
              embed_dim,
              norm_layer=norm_layer,
              pad_type=pad_type,
          )
      else:
          self.pool = nn.Identity()
  
      # Transformer encoder
      if len(drop_path):
          assert (
              len(drop_path) == depth
          ), "Must provide as many drop path rates as there are transformer layers"
      self.transformer_encoder = nn.Sequential(
          *[
              TransformerLayer(
                  dim=embed_dim,
                  num_heads=num_heads,
                  mlp_ratio=mlp_ratio,
                  qkv_bias=qkv_bias,
                  proj_drop=proj_drop,
                  attn_drop=attn_drop,
                  drop_path=drop_path[i],
                  norm_layer=norm_layer,
                  act_layer=act_layer,
              )
              for i in range(depth)
          ]
      )
  
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 1 to create a new NestLevel object from inherited base classes: nn with example: obj = NestLevel(num_blocks, block_size, seq_length, num_heads, depth, embed_dim, prev_embed_dim, mlp_ratio, qkv_bias, proj_drop, attn_drop, drop_path, norm_layer, act_layer, pad_type)