code: def __init__(
      self,
      in_channels: int = 4,
      out_channels: int = 3,
      block_out_channels: Tuple[int] = (128, 256, 512, 512),
      layers_per_block: int = 2,
  ):
      super().__init__()
      self.layers_per_block = layers_per_block
  
      self.conv_in = nn.Conv2d(
          in_channels,
          block_out_channels[-1],
          kernel_size=3,
          stride=1,
          padding=1,
      )
      self.mid_block = MidBlockTemporalDecoder(
          num_layers=self.layers_per_block,
          in_channels=block_out_channels[-1],
          out_channels=block_out_channels[-1],
          attention_head_dim=block_out_channels[-1],
      )
  
      # up
      self.up_blocks = nn.ModuleList([])
      reversed_block_out_channels = list(reversed(block_out_channels))
      output_channel = reversed_block_out_channels[0]
      for i in range(len(block_out_channels)):
          prev_output_channel = output_channel
          output_channel = reversed_block_out_channels[i]
  
          is_final_block = i == len(block_out_channels) - 1
          up_block = UpBlockTemporalDecoder(
              num_layers=self.layers_per_block + 1,
              in_channels=prev_output_channel,
              out_channels=output_channel,
              add_upsample=not is_final_block,
          )
          self.up_blocks.append(up_block)
          prev_output_channel = output_channel
  
      self.conv_norm_out = nn.GroupNorm(
          num_channels=block_out_channels[0], num_groups=32, eps=1e-6
      )
  
      self.conv_act = nn.SiLU()
      self.conv_out = torch.nn.Conv2d(
          in_channels=block_out_channels[0],
          out_channels=out_channels,
          kernel_size=3,
          padding=1,
      )
  
      conv_out_kernel_size = (3, 1, 1)
      padding = [int(k // 2) for k in conv_out_kernel_size]
      self.time_conv_out = torch.nn.Conv3d(
          in_channels=out_channels,
          out_channels=out_channels,
          kernel_size=conv_out_kernel_size,
          padding=padding,
      )
  
      self.gradient_checkpointing = False
  
imports: from typing import Dict, Optional, Tuple, Union
  import torch
  import torch.nn
  from ...configuration_utils import ConfigMixin, register_to_config
  from ...loaders import FromOriginalVAEMixin
  from ...utils import is_torch_version
  from ...utils.accelerate_utils import apply_forward_hook
  from ..attention_processor import CROSS_ATTENTION_PROCESSORS, AttentionProcessor, AttnProcessor
  from ..modeling_outputs import AutoencoderKLOutput
  from ..modeling_utils import ModelMixin
  from ..unet_3d_blocks import MidBlockTemporalDecoder, UpBlockTemporalDecoder
  from .vae import DecoderOutput, DiagonalGaussianDistribution, Encoder
label_desc: Use image node_id 1 to create a new TemporalDecoder object from inherited base classes: nn with example: obj = TemporalDecoder(in_channels, out_channels, block_out_channels, layers_per_block)