class_docstr: A module to blend spatial and temporal features.
  
  Parameters:
      alpha (`float`): The initial value of the blending factor.
      merge_strategy (`str`, *optional*, defaults to `learned_with_images`):
          The merge strategy to use for the temporal mixing.
      switch_spatial_to_temporal_mix (`bool`, *optional*, defaults to `False`):
          If `True`, switch the spatial and temporal mixing.
class_docstr_tok: ["A","module","to","blend","spatial","and","temporal","features",".","Parameters",":","alpha","(","`","float","`",")",":","The","initial","value","of","the","blending","factor",".","merge_strategy","(","`","str","`",",","*","optional","*",",","defaults","to","`","learned_with_images","`",")",":","The","merge","strategy","to","use","for","the","temporal","mixing",".","switch_spatial_to_temporal_mix","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","If","`","True","`",",","switch","the","spatial","and","temporal","mixing","."]
code: def __init__(
      self,
      alpha: float,
      merge_strategy: str = "learned_with_images",
      switch_spatial_to_temporal_mix: bool = False,
  ):
      super().__init__()
      self.merge_strategy = merge_strategy
      self.switch_spatial_to_temporal_mix = (
          switch_spatial_to_temporal_mix  # For TemporalVAE
      )
  
      if merge_strategy not in self.strategies:
          raise ValueError(
              f"merge_strategy needs to be in {self.strategies}"
          )
  
      if self.merge_strategy == "fixed":
          self.register_buffer("mix_factor", torch.Tensor([alpha]))
      elif (
          self.merge_strategy == "learned"
          or self.merge_strategy == "learned_with_images"
      ):
          self.register_parameter(
              "mix_factor", torch.nn.Parameter(torch.Tensor([alpha]))
          )
      else:
          raise ValueError(
              f"Unknown merge strategy {self.merge_strategy}"
          )
  
imports: from functools import partial
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from ..utils import USE_PEFT_BACKEND
  from .activations import get_activation
  from .attention_processor import SpatialNorm
  from .downsampling import Downsample1D, Downsample2D, FirDownsample2D, KDownsample2D, downsample_2d
  from .lora import LoRACompatibleConv, LoRACompatibleLinear
  from .normalization import AdaGroupNorm
  from .upsampling import FirUpsample2D, KUpsample2D, Upsample1D, Upsample2D, upfirdn2d_native, upsample_2d
label_desc: Use image node_id 1 to create a new AlphaBlender object from inherited base classes: nn with example: obj = AlphaBlender(alpha, merge_strategy, switch_spatial_to_temporal_mix)