code: def _fd_fprime(x, f, h):
      """(internal) Computes finite difference."""
      g = np.zeros(len(x))
      for i in range(len(x)):
          xph = np.copy(x)
          xmh = np.copy(x)
          xph[i] += h
          xmh[i] -= h
          fph = f(xph)
          fmh = f(xmh)
          g[i] = (fph - fmh) / (2 * h)
  
      return g
  
imports: from cuml.common import has_scipy
  import cuml.internals.logger
  from cuml.internals.safe_imports import cpu_only_import, gpu_only_import_from, null_decorator
label_desc: Use image node_id 1 for calling a global function with example usage: _fd_fprime(x, f, h) and returns: g