code: def test_zero_probability():
      """When p = 0 in kl divergence the score should not output Nan."""
      metric = KLDivergence()
      metric.update(
          torch.tensor(
              [[1.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]]
          ),
          torch.tensor(torch.randn(3, 3).softmax(dim=-1)),
      )
      assert not torch.isnan(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 4 for calling a global function with example usage: test_zero_probability() without return types