code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      latent_dim: int,
      has_first_conv: bool,
      demodulate: bool,
      upscale: bool,
      activation: nn.Module,
      layer: int = 0,
  ):
      super().__init__()
      self.layer = layer
      self.activation = activation
      self.conv_1 = None
      if not has_first_conv:
          if in_channels != out_channels:
              raise ValueError(
                  "`in_channels` should equal to `out_channels` "
                  "when `has_first_conv` is False"
              )
      else:
          if not upscale:
              self.conv_1 = Conv2d(
                  in_channels,
                  out_channels,
                  kernel_size=3,
                  padding=1,
                  bias=False,
                  demodulate=demodulate,
              )
          else:
              self.conv_1 = UpsampleConv2d(
                  in_channels,
                  out_channels,
                  kernel_size=3,
                  transform_kernel=True,
                  padding="reflection",
                  bias=False,
                  demodulate=demodulate,
                  factor=2,
              )
  
      norm_factory = NormFactory("instance")
      norm_kwargs = {"affine": False, "eps": 1e-8}
  
      self.blur = GaussianBlur3(out_channels)
      self.noise_weight_1 = nn.Parameter(
          torch.empty(1, out_channels, 1, 1)
      )
      self.noise_weight_1.data.zero_()
      self.bias_1 = nn.Parameter(torch.empty(1, out_channels, 1, 1))
      if demodulate:
          self.instance_norm_1 = None
      else:
          self.instance_norm_1 = norm_factory.make(
              out_channels, **norm_kwargs
          )
      self.style_1 = Linear(latent_dim, 2 * out_channels)
  
      self.conv_2 = Conv2d(
          out_channels,
          out_channels,
          kernel_size=3,
          padding=1,
          bias=False,
          demodulate=demodulate,
      )
      self.noise_weight_2 = nn.Parameter(
          torch.empty(1, out_channels, 1, 1)
      )
      self.noise_weight_2.data.zero_()
      self.bias_2 = nn.Parameter(torch.empty(1, out_channels, 1, 1))
      if demodulate:
          self.instance_norm_2 = None
      else:
          self.instance_norm_2 = norm_factory.make(
              out_channels, **norm_kwargs
          )
      self.style_2 = Linear(latent_dim, 2 * out_channels)
  
      with torch.no_grad():
          self.bias_1.zero_()
          self.bias_2.zero_()
  
imports: import math
  import torch
  from typing import *
  from torch import nn
  from torch import Tensor
  from torch.nn import init
  from cftool.types import tensor_dict_type
  from .schema import Decoder1DMixin
  from ....constants import INPUT_KEY
  from ....constants import LABEL_KEY
  from ....constants import LATENT_KEY
  from ....misc.toolkit import auto_num_layers
  from ....modules.blocks import Conv2d
  from ....modules.blocks import Linear
  from ....modules.blocks import GaussianBlur3
  from ....modules.blocks import Activation
  from ....modules.blocks import NormFactory
  from ....modules.blocks import UpsampleConv2d
label_desc: Use image node_id 1 to create a new DecodeBlock object from inherited base classes: nn with example: obj = DecodeBlock(in_channels, out_channels, latent_dim, has_first_conv, demodulate, upscale, activation, layer)