def before_update(self):
        """Calculate returns for the collected data."""
        next_values = self.agent.get_next_values(np.concatenate(self.buffer.obs[-1]))
        next_values = np.array(np.split(next_values, self.n_rollout_threads))
        if self.algo == "APPO":
            self.buffer.batch_process_appo(next_values)
        elif self.algo == "TPPO":
            self.buffer.batch_process_tppo(next_values)
        elif self.algo == "GRPO":
            self.buffer.batch_process_grpo()
        else:
            raise NotImplementedError
Calculate returns for the collected data.
train/mat/runner/shared/math_runner.py