code: def __init__(
      self,
      in_channels,
      n_heads,
      d_head,
      depth=1,
      dropout=0.0,
      use_linear=False,
      context_dim=None,
      use_spatial_context=False,
      timesteps=None,
      merge_strategy: str = "fixed",
      merge_factor: float = 0.5,
      time_context_dim=None,
      ff_in=False,
      checkpoint=False,
      time_depth=1,
      attn_mode="softmax",
      disable_self_attn=False,
      disable_temporal_crossattention=False,
      max_time_embed_period: int = 10000,
  ):
      super().__init__(
          in_channels,
          n_heads,
          d_head,
          depth=depth,
          dropout=dropout,
          attn_type=attn_mode,
          use_checkpoint=checkpoint,
          context_dim=context_dim,
          use_linear=use_linear,
          disable_self_attn=disable_self_attn,
      )
      self.time_depth = time_depth
      self.depth = depth
      self.max_time_embed_period = max_time_embed_period
  
      time_mix_d_head = d_head
      n_time_mix_heads = n_heads
  
      time_mix_inner_dim = int(time_mix_d_head * n_time_mix_heads)
  
      inner_dim = n_heads * d_head
      if use_spatial_context:
          time_context_dim = context_dim
  
      self.time_stack = nn.ModuleList(
          [
              VideoTransformerBlock(
                  inner_dim,
                  n_time_mix_heads,
                  time_mix_d_head,
                  dropout=dropout,
                  context_dim=time_context_dim,
                  timesteps=timesteps,
                  checkpoint=checkpoint,
                  ff_in=ff_in,
                  inner_dim=time_mix_inner_dim,
                  attn_mode=attn_mode,
                  disable_self_attn=disable_self_attn,
                  disable_temporal_crossattention=disable_temporal_crossattention,
              )
              for _ in range(self.depth)
          ]
      )
  
      assert len(self.time_stack) == len(self.transformer_blocks)
  
      self.use_spatial_context = use_spatial_context
      self.in_channels = in_channels
  
      time_embed_dim = self.in_channels * 4
      self.time_pos_embed = nn.Sequential(
          linear(self.in_channels, time_embed_dim),
          nn.SiLU(),
          linear(time_embed_dim, self.in_channels),
      )
  
      self.time_mixer = AlphaBlender(
          alpha=merge_factor, merge_strategy=merge_strategy
      )
  
file_path: generative-models/sgm/modules/video_attention.py
imports: import torch
  from ..modules.attention import *
  from ..modules.diffusionmodules.util import AlphaBlender, linear, timestep_embedding
label_desc: Use image node_id 1 to create a new SpatialVideoTransformer object from inherited base classes: SpatialTransformer with example: obj = SpatialVideoTransformer(in_channels, n_heads, d_head, depth, dropout, use_linear, context_dim, use_spatial_context, timesteps, merge_strategy, merge_factor, time_context_dim, ff_in, checkpoint, time_depth, attn_mode, disable__attn, disable_temporal_crossattention, max_time_embed_period)