class_docstr: Quantization bottleneck.
  
  This class quantizes its input based on a codebook. Each entry is quantized
  to its nearest codebook representation according to Euclidean distance.
  
  Args:
      codebook_sizes: Size of the codebook for each quantization level.
      hidden_dims: Hidden dimension size, i.e., the sizes of the input
          vectors.
      init_distribution: Initialization distribution for the codebooks.
      normalize_codebook: Whether to renormalize the codebook prior to each
          quantization run.
code: def __init__(
      self,
      codebook_sizes: Sequence[int],
      hidden_dims: Sequence[int],
      init_distribution: str = "uniform",
      normalize_codebook: bool = True,
  ):
      super().__init__()
      self.normalize_codebook = normalize_codebook
  
      codebook_list = []
      for codebook_size, hidden_dim in zip(codebook_sizes, hidden_dims):
          codebook_list.append(
              nn.Parameter(
                  _build_codebook(
                      codebook_size,
                      hidden_dim,
                      init_distribution=init_distribution,
                  )
              )
          )
  
      self.codebooks = nn.ParameterList(codebook_list)
      num_codebooks = len(self.codebooks)
  
      # tracking for codebook metrics
      for ind, codebook in enumerate(self.codebooks):
          self.register_buffer(
              f"codebook_hits_{ind}",
              torch.zeros(codebook.shape[0], dtype=torch.long),
          )
      self.register_buffer("perplexities", torch.zeros(num_codebooks))
      self.register_buffer("max_hits", torch.zeros(num_codebooks))
      self.register_buffer(
          "percentage_hits", torch.zeros(num_codebooks)
      )
  
file_path: NeuralCompression/neuralcompression/layers/_q_bottleneck.py
imports: from typing import NamedTuple, Optional, Sequence
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
label_desc: Use image node_id 1 to create a new QBottleneck object from inherited base classes: nn with example: obj = QBottleneck(codebook_sizes, hidden_dims, init_distribution, normalize_codebook)