code: def discount(vector, gamma):
      """
      computes discounted sums along 0th dimension of vector x.
          y[t] = x[t] + gamma*x[t+1] + gamma^2*x[t+2] + ... + gamma^k x[t+k],
                  where k = len(x) - t - 1
  
      :param vector: (np.ndarray) the input vector
      :param gamma: (float) the discount value
      :return: (np.ndarray) the output vector
      """
      assert vector.ndim >= 1
      return scipy.signal.lfilter(
          [1], [1, -gamma], vector[::-1], axis=0
      )[::-1]
  
file_path: stable-baselines/stable_baselines/common/math_util.py
imports: import numpy
  import scipy.signal
label_desc: Use image node_id 2 for calling a global function with example usage: discount(vector, gamma) and returns: scipy