code: def _handle_numerical_errors(
      error: RuntimeError,
      x: np.ndarray,
      dtype: Optional[np.dtype] = None,
  ) -> Tuple[np.ndarray, np.ndarray]:
      if isinstance(error, NotPSDError):
          raise error
      error_message = error.args[0] if len(error.args) > 0 else ""
      if (
          isinstance(error, NanError)
          or "singular" in error_message  # old pytorch message
          or "input is not positive-definite"
          in error_message  # since pytorch #63864
      ):
          _dtype = x.dtype if dtype is None else dtype
          return np.full((), "nan", dtype=_dtype), np.full_like(
              x, "nan", dtype=_dtype
          )
      raise error
  
file_path: botorch/botorch/optim/utils/common.py
imports: from __future__ import annotations
  from inspect import signature
  from logging import debug
  from typing import Any, Callable, Optional, Tuple
  from warnings import warn, warn_explicit, WarningMessage
  import numpy
  from linear_operator.utils.errors import NanError, NotPSDError
label_desc: Use image node_id 2 for calling a global function with example usage: _handle_numerical_errors(error, x, dtype) and returns: np,  np