class_docstr: Test class for `KLDivergence` metric.
class_docstr_tok: ["Test","class","for","`","KLDivergence","`","metric","."]
docstr: Test functional implementation of metric.
docstr_tok: ["Test","functional","implementation","of","metric","."]
code: def test_kldivergence_functional(self, reduction, p, q, log_prob):
      """Test functional implementation of metric."""
      self.run_functional_metric_test(
          p,
          q,
          kl_divergence,
          partial(
              _wrap_reduction, log_prob=log_prob, reduction=reduction
          ),
          metric_args={"log_prob": log_prob, "reduction": reduction},
      )
  
imports: from functools import partial
  from typing import NamedTuple, Optional
  import numpy
  import pytest
  import torch
  from scipy.stats import entropy
  from torch import Tensor
  from torchmetrics.functional.regression.kl_divergence import kl_divergence
  from torchmetrics.regression.kl_divergence import KLDivergence
  from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_2_1
  from unittests import BATCH_SIZE, EXTRA_DIM, NUM_BATCHES
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 2 for calling the TestKLDivergence obj's underlying member method code with example usage: obj.test_kldivergence_functional(reduction, p, q, log_prob) without return types