class_docstr: used in AsymmetricAutoencoderKL
code: def __init__(
      self,
      in_ch: int,
      out_ch: int = 192,
      res_ch: int = 768,
      stride: int = 16,
  ) -> None:
      super().__init__()
  
      channels = []
      while stride > 1:
          stride = stride // 2
          in_ch_ = out_ch * 2
          if out_ch > res_ch:
              out_ch = res_ch
          if stride == 1:
              in_ch_ = res_ch
          channels.append((in_ch_, out_ch))
          out_ch *= 2
  
      out_channels = []
      for _in_ch, _out_ch in channels:
          out_channels.append(_out_ch)
      out_channels.append(channels[-1][0])
  
      layers = []
      in_ch_ = in_ch
      for l in range(len(out_channels)):
          out_ch_ = out_channels[l]
          if l == 0 or l == 1:
              layers.append(
                  nn.Conv2d(
                      in_ch_,
                      out_ch_,
                      kernel_size=3,
                      stride=1,
                      padding=1,
                  )
              )
          else:
              layers.append(
                  nn.Conv2d(
                      in_ch_,
                      out_ch_,
                      kernel_size=4,
                      stride=2,
                      padding=1,
                  )
              )
          in_ch_ = out_ch_
  
      self.layers = nn.Sequential(*layers)
  
imports: from dataclasses import dataclass
  from typing import Optional
  import numpy
  import torch
  import torch.nn
  from ..utils import BaseOutput, is_torch_version
  from ..utils.torch_utils import randn_tensor
  from .activations import get_activation
  from .attention_processor import SpatialNorm
  from .unet_2d_blocks import AutoencoderTinyBlock, UNetMidBlock2D, get_down_block, get_up_block
label_desc: Use image node_id 1 to create a new MaskConditionEncoder object from inherited base classes: nn with example: obj = MaskConditionEncoder(in_ch, out_ch, res_ch, stride)