class_docstr: Reversible Blocks for Reversible Vision Transformer and also
  for state-preserving blocks in Reversible MViT. See Section
  3.3.2 in paper for details.
class_docstr_tok: ["Reversible","Blocks","for","Reversible","Vision","Transformer","and","also","for","state-preserving","blocks","in","Reversible","MViT",".","See","Section","3.3.2","in","paper","for","details","."]
docstr: Block is composed entirely of function F (Attention
  sub-block) and G (MLP sub-block) including layernorm.
docstr_tok: ["Block","is","composed","entirely","of","function","F","(","Attention","sub-block",")","and","G","(","MLP","sub-block",")","including","layernorm","."]
code: def __init__(
      self,
      dim,
      input_size,
      dim_out,
      num_heads,
      mlp_ratio,
      qkv_bias,
      drop_path,
      kernel_q,
      kernel_kv,
      stride_q,
      stride_kv,
      cfg,
      norm_layer=nn.LayerNorm,
      layer_id=0,
      **kwargs,
  ):
      """
      Block is composed entirely of function F (Attention
      sub-block) and G (MLP sub-block) including layernorm.
      """
      super().__init__()
  
      self.drop_path_rate = drop_path
  
      self.F = AttentionSubBlock(
          dim=dim,
          input_size=input_size,
          num_heads=num_heads,
          cfg=cfg,
          dim_out=dim_out,
          kernel_q=kernel_q,
          kernel_kv=kernel_kv,
          stride_q=stride_q,
          stride_kv=stride_kv,
          norm_layer=norm_layer,
      )
  
      self.G = MLPSubblock(
          dim=dim,
          mlp_ratio=mlp_ratio,
          norm_layer=norm_layer,
      )
  
      self.layer_id = layer_id
  
      self.seeds = {}
  
imports: import sys
  from functools import partial
  import torch
  from torch import nn
  from torch.autograd import Function
  from slowfast.models.attention import MultiScaleAttention, attention_pool
  from slowfast.models.common import Mlp, TwoStreamFusion, drop_path
  from slowfast.models.utils import round_width
label_desc: Use image node_id 1 to create a new ReversibleBlock object from inherited base classes: nn with example: obj = ReversibleBlock(dim, input_size, dim_out, num_heads, mlp_ratio, qkv_bias, drop_path, kernel_q, kernel_kv, stride_q, stride_kv, cfg, norm_layer, layer_id)