code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      num_blocks: int,
      block_out_channels: int,
      act_fn: str,
  ):
      super().__init__()
  
      layers = []
      for i, num_block in enumerate(num_blocks):
          num_channels = block_out_channels[i]
  
          if i == 0:
              layers.append(
                  nn.Conv2d(
                      in_channels,
                      num_channels,
                      kernel_size=3,
                      padding=1,
                  )
              )
          else:
              layers.append(
                  nn.Conv2d(
                      num_channels,
                      num_channels,
                      kernel_size=3,
                      padding=1,
                      stride=2,
                      bias=False,
                  )
              )
  
          for _ in range(num_block):
              layers.append(
                  AutoencoderTinyBlock(
                      num_channels, num_channels, act_fn
                  )
              )
  
      layers.append(
          nn.Conv2d(
              block_out_channels[-1],
              out_channels,
              kernel_size=3,
              padding=1,
          )
      )
  
      self.layers = nn.Sequential(*layers)
      self.gradient_checkpointing = False
  
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 EncoderTiny object from inherited base classes: nn with example: obj = EncoderTiny(in_channels, out_channels, num_blocks, block_out_channels, act_fn)