code: def __init__(
      self,
      dim,
      n_heads,
      d_head,
      dropout=0.0,
      context_dim=None,
      gated_ff=True,
      use_checkpoint=False,
      use_flash_attention=False,
      disable_self_attn=False,
  ):
      super().__init__()
      self.disable_self_attn = disable_self_attn
      self.attn1 = CrossAttention(
          query_dim=dim,
          heads=n_heads,
          dim_head=d_head,
          dropout=dropout,
          use_flash_attention=use_flash_attention,
          context_dim=context_dim if self.disable_self_attn else None,
      )  # is a self-attention
      self.ff = FeedForward(dim, dropout=dropout, glu=gated_ff)
      self.attn2 = CrossAttention(
          query_dim=dim,
          context_dim=context_dim,
          heads=n_heads,
          dim_head=d_head,
          dropout=dropout,
          use_flash_attention=use_flash_attention,
      )  # is self-attn if context is none
      self.norm1 = nn.LayerNorm(dim)
      self.norm2 = nn.LayerNorm(dim)
      self.norm3 = nn.LayerNorm(dim)
      self.use_checkpoint = use_checkpoint
  
imports: import math
  from inspect import isfunction
  import torch
  import torch.nn.functional
  from apex.contrib.group_norm import GroupNorm
  from einops import rearrange
  from torch import einsum, nn
  from torch._dynamo import disable
  from nemo.collections.multimodal.modules.stable_diffusion.diffusionmodules.util import checkpoint
label_desc: Use image node_id 1 to create a new BasicTransformerBlock object from inherited base classes: nn with example: obj = BasicTransformerBlock(dim, n_heads, d_head, dropout, context_dim, gated_ff, use_checkpoint, use_flash_attention, disable__attn)