code: def _initialize(
      self,
      *,
      out_channels: int,
      img_size: Optional[int],
      num_upsample: Optional[int],
      num_classes: Optional[int],
      latent_resolution: Optional[int],
  ) -> None:
      if num_upsample is None:
          fmt = "`{}` should be provided when `num_upsample` is not"
          if img_size is None:
              raise ValueError(fmt.format("img_size"))
          if latent_resolution is None:
              print_warning(
                  f'{fmt.format("latent_resolution")}, '
                  "and 7 will be used as the default `latent_resolution` now"
              )
              latent_resolution = 7
          num_upsample = auto_num_layers(
              img_size, latent_resolution, None
          )
      self.num_upsample = num_upsample
      self.out_channels = out_channels
      self.img_size = img_size
      self.num_classes = num_classes
      self.latent_resolution = latent_resolution
  
imports: from torch import Tensor
  from typing import Any
  from typing import Dict
  from typing import Type
  from typing import Optional
  from cftool.misc import safe_execute
  from cftool.misc import print_warning
  from cftool.misc import shallow_copy_dict
  from cftool.misc import WithRegister
  from cftool.types import tensor_dict_type
  from ....schema import _forward
  from ....schema import TrainerState
  from ....constants import INPUT_KEY
  from ....constants import LABEL_KEY
  from ....constants import PREDICTIONS_KEY
  from ....misc.toolkit import interpolate
  from ....misc.toolkit import auto_num_layers
  from ....modules.blocks import ChannelPadding
label_desc: Use image node_id 1 for calling the IDecoder obj's underlying member method code with example usage: obj._initialize() without return types