def compute_rtgs(self, batch_rews):
    '\n\t\t\tCompute the Reward-To-Go of each timestep in a batch given the rewards.\n\n\t\t\tParameters:\n\t\t\t\tbatch_rews - the rewards in a batch, Shape: (number of episodes, number of timesteps per episode)\n\n\t\t\tReturn:\n\t\t\t\tbatch_rtgs - the rewards to go, Shape: (number of timesteps in batch)\n\t\t'
    batch_rtgs = []
    for ep_rews in reversed(batch_rews):
        discounted_reward = 0
        for rew in reversed(ep_rews):
            discounted_reward = (rew + (discounted_reward * self.gamma))
            batch_rtgs.insert(0, discounted_reward)
    batch_rtgs = torch.tensor(batch_rtgs, dtype=torch.float)
    return batch_rtgs
Compute the Reward-To-Go of each timestep in a batch given the rewards.

Parameters:
        batch_rews - the rewards in a batch, Shape: (number of episodes, number of timesteps per episode)

Return:
        batch_rtgs - the rewards to go, Shape: (number of timesteps in batch)
def compute_rtgs(self, batch_rews):
    '\n\t\t\tCompute the Reward-To-Go of each timestep in a batch given the rewards.\n\n\t\t\tParameters:\n\t\t\t\tbatch_rews - the rewards in a batch, Shape: (number of episodes, number of timesteps per episode)\n\n\t\t\tReturn:\n\t\t\t\tbatch_rtgs - the rewards to go, Shape: (number of timesteps in batch)\n\t\t'
    batch_rtgs = []
    for ep_rews in reversed(batch_rews):
        discounted_reward = 0
        for rew in reversed(ep_rews):
            discounted_reward = (rew + (discounted_reward * self.gamma))
            batch_rtgs.insert(0, discounted_reward)
    batch_rtgs = torch.tensor(batch_rtgs, dtype=torch.float)
    return batch_rtgs