code: def _safe_xlogy(x: Tensor, y: Tensor) -> Tensor:
      """Compute x * log(y). Returns 0 if x=0.
  
      Example:
          >>> import torch
          >>> x = torch.zeros(1)
          >>> _safe_xlogy(x, 1/x)
          tensor([0.])
  
      """
      res = x * torch.log(y)
      res[x == 0] = 0.0
      return res
  
file_path: torchmetrics/src/torchmetrics/utilities/compute.py
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 2 for calling a global function with example usage: _safe_xlogy(x, y) and returns: res