class_docstr: Base implementation for KL Divergence metric.
  
  The KL divergence is measured between probability distributions
  of class predictions returned by a pre-trained audio classification model.
  When the KL-divergence is low, the generated audio is expected to
  have similar acoustic characteristics as the reference audio,
  according to the classifier.
class_docstr_tok: ["Base","implementation","for","KL","Divergence","metric",".","The","KL","divergence","is","measured","between","probability","distributions","of","class","predictions","returned","by","a","pre-trained","audio","classification","model",".","When","the","KL-divergence","is","low",",","the","generated","audio","is","expected","to","have","similar","acoustic","characteristics","as","the","reference","audio",",","according","to","the","classifier","."]
docstr: Computes KL-Divergence across all evaluated pred/target pairs.
docstr_tok: ["Computes","KL-Divergence","across","all","evaluated","pred\/target","pairs","."]
code: def compute(self) -> dict:
      """Computes KL-Divergence across all evaluated pred/target pairs."""
      weight: float = float(self.weight.item())  # type: ignore
      assert (
          weight > 0
      ), "Unable to compute with total number of comparisons <= 0"
      logger.info(
          f"Computing KL divergence on a total of {weight} samples"
      )
      kld_pq = self.kld_pq_sum.item() / weight  # type: ignore
      kld_qp = self.kld_qp_sum.item() / weight  # type: ignore
      kld_both = kld_pq + kld_qp
      return {
          "kld": kld_pq,
          "kld_pq": kld_pq,
          "kld_qp": kld_qp,
          "kld_both": kld_both,
      }
  
imports: import contextlib
  from functools import partial
  import logging
  import os
  import typing
  import torch
  import torchmetrics
  from ..data.audio_utils import convert_audio
label_desc: Use image node_id 4 for calling the KLDivergenceMetric obj's underlying member method code with example usage: obj.compute() and returns: dict