def discounted_return(self, gamma: float) -> (to.Tensor, np.ndarray):
    '\n        Compute the discounted return.\n\n        :param gamma: temporal discount factor\n        :return: exponentially weighted sum of rewards\n        '
    if (not (len(self._rollout_bounds) == 2)):
        raise pyrado.ShapeErr(msg='The StepSequence must be a single continuous rollout.')
    if (not (0 <= gamma <= 1)):
        raise pyrado.ValueErr(given=gamma, ge_constraint='0', le_constraint='1')
    if (self.data_format == 'torch'):
        return to.dot(self.rewards, (gamma ** to.arange(self.length)))
    else:
        return np.dot(self.rewards, (gamma ** np.arange(self.length)))
Compute the discounted return.

:param gamma: temporal discount factor
:return: exponentially weighted sum of rewards
def discounted_return(self, gamma: float) -> (to.Tensor, np.ndarray):
    '\n        Compute the discounted return.\n\n        :param gamma: temporal discount factor\n        :return: exponentially weighted sum of rewards\n        '
    if (not (len(self._rollout_bounds) == 2)):
        raise pyrado.ShapeErr(msg='The StepSequence must be a single continuous rollout.')
    if (not (0 <= gamma <= 1)):
        raise pyrado.ValueErr(given=gamma, ge_constraint='0', le_constraint='1')
    if (self.data_format == 'torch'):
        return to.dot(self.rewards, (gamma ** to.arange(self.length)))
    else:
        return np.dot(self.rewards, (gamma ** np.arange(self.length)))