code: def _safe_divide(num: Tensor, denom: Tensor) -> Tensor:
      """Safe division, by preventing division by zero.
  
      Additionally casts to float if input is not already to secure backwards compatibility.
  
      """
      denom[denom == 0.0] = 1
      num = num if num.is_floating_point() else num.float()
      denom = denom if denom.is_floating_point() else denom.float()
      return num / denom
  
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 3 for calling a global function with example usage: _safe_divide(num, denom) and returns: unknown