class_docstr: Quantizes incoming data using Gumbel-Softmax.
class_docstr_tok: ["Quantizes","incoming","data","using","Gumbel-Softmax","."]
docstr: :param input_dim:
      The dimensionality of inputs.
  :param output_dim:
      The dimensionality of quantized outputs.
  :param num_codebooks:
      number of groups for vector quantization
  :param num_codebook_entries:
      number of quantized vectors per group
  :param codebook_sampling_temperature:
      The temperature for training. A tuple of maximum temperature,
      minimum temperature, and decay factor.
docstr_tok: [":","param","input_dim",":","The","dimensionality","of","inputs",".",":","param","output_dim",":","The","dimensionality","of","quantized","outputs",".",":","param","num_codebooks",":","number","of","groups","for","vector","quantization",":","param","num_codebook_entries",":","number","of","quantized","vectors","per","group",":","param","codebook_sampling_temperature",":","The","temperature","for","training",".","A","tuple","of","maximum","temperature",",","minimum","temperature",",","and","decay","factor","."]
code: def __init__(
      self,
      input_dim: int,
      output_dim: int,
      num_codebooks: int,
      num_codebook_entries: int,
      *,
      codebook_sampling_temperature: Tuple[float, float, float],
      device: Optional[Device] = None,
      dtype: Optional[DataType] = None,
  ):
      """
      :param input_dim:
          The dimensionality of inputs.
      :param output_dim:
          The dimensionality of quantized outputs.
      :param num_codebooks:
          number of groups for vector quantization
      :param num_codebook_entries:
          number of quantized vectors per group
      :param codebook_sampling_temperature:
          The temperature for training. A tuple of maximum temperature,
          minimum temperature, and decay factor.
      """
      super().__init__(input_dim, output_dim)
  
      if output_dim % num_codebooks != 0:
          raise ValueError(
              f"`output_dim` must be a multiple of `num_codebooks` ({num_codebooks}), but is {output_dim} instead."
          )
  
      entry_dim = output_dim // num_codebooks
  
      self.input_dim = input_dim
      self.output_dim = output_dim
      self.num_codebooks = num_codebooks
      self.num_codebook_entries = num_codebook_entries
      (
          self.max_temp,
          self.min_temp,
          self.temp_decay,
      ) = codebook_sampling_temperature
  
      num_total_entries = num_codebooks * num_codebook_entries
  
      self.entry_proj = Linear(
          self.input_dim,
          num_total_entries,
          bias=True,
          init_fn=init_entry_projection,
          device=device,
          dtype=dtype,
      )
  
      self.entries = Parameter(
          torch.empty(
              (1, num_total_entries, entry_dim),
              device=device,
              dtype=dtype,
          )
      )
  
      num_updates = torch.empty((), device=device, dtype=torch.int64)
  
      self.register_buffer("num_updates", num_updates)
  
      self.reset_parameters()
  
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import Optional, Tuple, final
  import torch
  import torch.nn
  from torch import Tensor
  from torch.nn import Module, Parameter
  from torch.nn.functional import gumbel_softmax
  from fairseq2.nn.projection import Linear
  from fairseq2.typing import DataType, Device, finaloverride
label_desc: Use image node_id 1 to create a new GumbelVectorQuantizer object from inherited base classes: VectorQuantizer with example: obj = GumbelVectorQuantizer(input_dim, output_dim, num_codebooks, num_codebook_entries)