code: def safe_mean(arr):
      """
      Compute the mean of an array if there is at least one element.
      For empty array, return nan. It is used for logging only.
  
      :param arr: (np.ndarray)
      :return: (float)
      """
      return np.nan if len(arr) == 0 else np.mean(arr)
  
file_path: stable-baselines/stable_baselines/common/math_util.py
imports: import numpy
  import scipy.signal
label_desc: Use image node_id 1 for calling a global function with example usage: safe_mean(arr) and returns: unknown