code: def __init__(
      self,
      in_channels=3,
      out_channels=3,
      down_block_types=("DownEncoderBlock2D",),
      block_out_channels=(64,),
      layers_per_block=2,
      act_fn="silu",
      double_z=True,
  ):
      super().__init__()
      self.layers_per_block = layers_per_block
  
      self.conv_in = nn.Conv2D(
          in_channels,
          block_out_channels[0],
          kernel_size=3,
          stride=1,
          padding=1,
      )
  
      self.mid_block = None
      self.down_blocks = nn.LayerList([])
  
      # down
      output_channel = block_out_channels[0]
      for i, down_block_type in enumerate(down_block_types):
          input_channel = output_channel
          output_channel = block_out_channels[i]
          is_final_block = i == len(block_out_channels) - 1
  
          down_block = get_down_block(
              down_block_type,
              num_layers=self.layers_per_block,
              in_channels=input_channel,
              out_channels=output_channel,
              add_downsample=not is_final_block,
              resnet_eps=1e-6,
              downsample_padding=0,
              resnet_act_fn=act_fn,
              attn_num_head_channels=None,
              temb_channels=None,
          )
          self.down_blocks.append(down_block)
  
      # mid
      self.mid_block = UNetMidBlock2D(
          in_channels=block_out_channels[-1],
          resnet_eps=1e-6,
          resnet_act_fn=act_fn,
          output_scale_factor=1,
          resnet_time_scale_shift="default",
          attn_num_head_channels=None,
          resnet_groups=32,
          temb_channels=None,
      )
  
      # out
      num_groups_out = 32
      self.conv_norm_out = nn.GroupNorm(
          num_channels=block_out_channels[-1],
          num_groups=num_groups_out,
          epsilon=1e-6,
      )
      self.conv_act = nn.Silu()
  
      conv_out_channels = 2 * out_channels if double_z else out_channels
      self.conv_out = nn.Conv2D(
          block_out_channels[-1], conv_out_channels, 3, padding=1
      )
  
imports: import numpy
  import paddle
  import paddle.nn
  from ..configuration_utils import ConfigMixin
  from ..configuration_utils import register_to_config
  from .unet_blocks import get_down_block
  from .unet_blocks import get_up_block
  from .unet_blocks import UNetMidBlock2D
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: nn with example: obj = Encoder(in_channels, out_channels, down_block_types, block_out_channels, layers_per_block, act_fn, double_z)