def _divide_no_nan(a, b):
    """
    a/b where the resulted NaN or Inf are replaced by 0.
    """
    result = a / b
    result[result != result] = 0.0
    result[result == np.inf] = 0.0
    result[result == -np.inf] = 0.0
    return result

    a/b where the resulted NaN or Inf are replaced by 0.
    
darts/utils/losses.py