code: def __init__(
      self,
      in_channels: int,
      num_downsample: int,
      latent_dim: int = 128,
      *,
      img_size: Optional[int] = None,
      kernel_size: int = 3,
      first_kernel_size: int = 7,
      start_channels: Optional[int] = None,
      num_residual_blocks: int = 0,
      residual_dropout: float = 0.0,
      residual_kwargs: Optional[Dict[str, Any]] = None,
      norm_type: Optional[str] = "batch",
      activation: str = "leaky_relu_0.2",
      padding: str = "same",
      pool: str = "average",
  ):
      super().__init__()
      self.in_channels = in_channels
      self.latent_dim = latent_dim
      self.encoder = VanillaEncoder(
          in_channels,
          num_downsample,
          latent_dim,
          kernel_size=kernel_size,
          first_kernel_size=first_kernel_size,
          start_channels=start_channels,
          num_residual_blocks=num_residual_blocks,
          residual_dropout=residual_dropout,
          residual_kwargs=residual_kwargs,
          norm_type=norm_type,
          activation=activation,
          padding=padding,
      )
      if pool == "average":
          self.pool = nn.AdaptiveAvgPool2d((1, 1))
      elif pool == "fc":
          if img_size is None:
              raise ValueError(
                  "`img_size` should be provided if `pool`=fc"
              )
          res = self.encoder.latent_resolution(img_size)
          flattened_dim = latent_dim * res**2
          self.pool = nn.Sequential(
              nn.Flatten(1), Linear(flattened_dim, latent_dim)
          )
      else:
          raise ValueError(f"unrecognized `pool` value : '{pool}'")
  
imports: import torch.nn
  from torch import Tensor
  from typing import Any
  from typing import Dict
  from typing import Optional
  from cftool.array import squeeze
  from .schema import EncoderMixin
  from .schema import Encoder1DMixin
  from ....modules.blocks import get_conv_blocks
  from ....modules.blocks import Linear
  from ....modules.blocks import ResidualBlock
label_desc: Use image node_id 1 to create a new VanillaEncoder1D object from inherited base classes: nn, Encoder1DMixin with example: obj = VanillaEncoder1D(in_channels, num_downsample, latent_dim)