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",")","."]
docstr: Updates location of model weights based on target_operation.
  
  Args:
      target_operation: Either ''forward'' or ''compress''. For
          ''forward'', all tensors will be located on the model device.
          For ''compress'', weights that are used for likelihood
          calculation will be held on the CPU.
docstr_tok: ["Updates","location","of","model","weights","based","on","target_operation",".","Args",":","target_operation",":","Either","``","forward","''","or","``","compress","''",".","For","``","forward","''",",","all","tensors","will","be","located","on","the","model","device",".","For","``","compress","''",",","weights","that","are","used","for","likelihood","calculation","will","be","held","on","the","CPU","."]
code: def update_tensor_devices(self, target_operation: str):
      """
      Updates location of model weights based on target_operation.
  
      Args:
          target_operation: Either ''forward'' or ''compress''. For
              ''forward'', all tensors will be located on the model device.
              For ''compress'', weights that are used for likelihood
              calculation will be held on the CPU.
      """
      if target_operation not in ("forward", "compress"):
          raise ValueError(
              "Target operation must be 'forward' or 'compress'."
          )
  
      if target_operation == "forward":
          target_device = self.encoder.blocks[0][0].weight.device
          self.to(target_device)
      else:
          self.update()
          self._set_devices_for_compress()
  
      self._device_setting = target_operation
  
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 5 for calling the HiFiCAutoencoder obj's underlying member method code with example usage: obj.update_tensor_devices(target_operation) without return types