class_docstr: HiFiC autoencoder architecture.
  
  This implements the HiFiC autoencoder as described in the following paper:
  
  High-Fidelity Generative Image Compression
  F. Mentzer, G. Toderici, M. Tschannen, E. Agustsson
  
  Args:
      in_channels: The number of channels in the input image.
      latent_features: The number of features to use as input to the
          conditional Gaussian layer.
      hyper_feautures: The number of features to use for the hyperprior.
      num_residual_blocks: Number of residual blocks to use at the start of
          generator decoding.
      freeze_encoder: Whether to freeze training of the encoder.
      freeze_bottleneck: Whether to freeze training of the bottleneck (both
          conditional Gaussian and hyperprior).
class_docstr_tok: ["HiFiC","autoencoder","architecture",".","This","implements","the","HiFiC","autoencoder","as","described","in","the","following","paper",":","High-Fidelity","Generative","Image","Compression","F.","Mentzer",",","G.","Toderici",",","M.","Tschannen",",","E.","Agustsson","Args",":","in_channels",":","The","number","of","channels","in","the","input","image",".","latent_features",":","The","number","of","features","to","use","as","input","to","the","conditional","Gaussian","layer",".","hyper_feautures",":","The","number","of","features","to","use","for","the","hyperprior",".","num_residual_blocks",":","Number","of","residual","blocks","to","use","at","the","start","of","generator","decoding",".","freeze_encoder",":","Whether","to","freeze","training","of","the","encoder",".","freeze_bottleneck",":","Whether","to","freeze","training","of","the","bottleneck","(","both","conditional","Gaussian","and","hyperprior",")","."]
code: def __init__(
      self,
      in_channels: int = 3,
      latent_features: int = 220,
      hyper_features: int = 320,
      num_residual_blocks: int = 9,
      freeze_encoder: bool = False,
      freeze_bottleneck: bool = False,
  ):
      super().__init__()
      self._factor = 64  # this is the full downsampling factor
      self._frozen_encoder = False
      self._frozen_bottleneck = False
      self.logger = logging.getLogger(self.__class__.__name__)
      self.encoder = HiFiCEncoder(
          in_channels=in_channels, latent_features=latent_features
      )
      self.decoder = HiFiCGenerator(
          image_channels=in_channels,
          latent_features=latent_features,
          n_residual_blocks=num_residual_blocks,
      )
      self.hyper_analysis = nn.Sequential(
          _conv(
              latent_features, hyper_features, stride=1, kernel_size=3
          ),
          nn.ReLU(inplace=True),
          _conv(hyper_features, hyper_features),
          nn.ReLU(inplace=True),
          _conv(hyper_features, hyper_features),
      )
      self.hyper_synthesis_mean = nn.Sequential(
          _deconv(hyper_features, hyper_features),
          nn.ReLU(inplace=True),
          _deconv(hyper_features, hyper_features),
          nn.ReLU(inplace=True),
          _conv(
              hyper_features,
              latent_features,
              stride=1,
              kernel_size=3,
          ),
      )
      self.hyper_synthesis_scale = nn.Sequential(
          _deconv(hyper_features, hyper_features),
          nn.ReLU(inplace=True),
          _deconv(hyper_features, hyper_features),
          nn.ReLU(inplace=True),
          _conv(
              hyper_features,
              latent_features,
              stride=1,
              kernel_size=3,
          ),
      )
      self.hyper_bottleneck = EntropyBottleneck(hyper_features)
      self.latent_bottleneck = GaussianConditional(scale_table=None)
  
      if freeze_encoder:
          self.freeze_encoder()
      if freeze_bottleneck:
          self.freeze_bottleneck()
  
      self.set_compress_cpu_layers(
          [
              self.hyper_bottleneck,
              self.latent_bottleneck,
              self.hyper_synthesis_scale,
              self.hyper_synthesis_mean,
              self.hyper_analysis,
          ]
      )
  
imports: import logging
  import torch
  import torch.nn
  from compressai.entropy_models import EntropyBottleneck, GaussianConditional
  from torch import Tensor
  import neuralcompression.functional
  from neuralcompression import HyperpriorCompressedOutput, HyperpriorOutput
  from ._hific_encoder_decoder import HiFiCEncoder, HiFiCGenerator
  from ._hyperprior_autoencoder import HyperpriorAutoencoderBase
label_desc: Use image node_id 1 to create a new HiFiCAutoencoder object from inherited base classes: HyperpriorAutoencoderBase with example: obj = HiFiCAutoencoder(in_channels, latent_features, hyper_features, num_residual_blocks, freeze_encoder, freeze_bottleneck)