code: def __init__(
      self,
      alpha: float,
      merge_strategy: str = "learned_with_images",
      rearrange_pattern: str = "b t -> (b t) 1 1",
  ):
      super().__init__()
      self.merge_strategy = merge_strategy
      self.rearrange_pattern = rearrange_pattern
  
      assert (
          merge_strategy in self.strategies
      ), 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: import math
  from typing import Optional
  import torch
  import torch.nn
  from einops import rearrange, repeat
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, rearrange_pattern)