code: def test_inf_case():
      """When q = 0 in kl divergence the score should be inf."""
      metric = KLDivergence()
      metric.update(
          torch.tensor([[0.3, 0.3, 0.4]]), torch.tensor([[0.5, 0.5, 0]])
      )
      assert not torch.isfinite(metric.compute())
  
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 5 for calling a global function with example usage: test_inf_case() without return types