code: def compute_returns(self, next_value, use_gae, gamma, tau):
      if use_gae:
          self.value_preds[-1] = next_value
          gae = 0
          for step in reversed(range(self.rewards.size(0))):
              delta = (
                  self.rewards[step]
                  + gamma
                  * self.value_preds[step + 1]
                  * self.masks[step + 1]
                  - self.value_preds[step]
              )
              gae = delta + gamma * tau * self.masks[step + 1] * gae
              self.returns[step] = gae + self.value_preds[step]
      else:
          self.returns[-1] = next_value
          for step in reversed(range(self.rewards.size(0))):
              self.returns[step] = (
                  self.returns[step + 1] * gamma * self.masks[step + 1]
                  + self.rewards[step]
              )
  
file_path: SerpentAI/serpent/machine_learning/reinforcement_learning/ppo/rollout_storage.py
imports: import torch
  from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler
label_desc: Use image node_id 5 for calling the RolloutStorage obj's underlying member method code with example usage: obj.compute_returns(next_value, use_gae, gamma, tau) without return types