code: def compute_mean_reward(rollouts, clipped):
    
    reward_name = "reward" if clipped else "unclipped_reward"
    rewards = []
    for rollout in rollouts:
      if rollout[-1].done:
        rollout_reward = sum(getattr(frame, reward_name) for frame in rollout)
        rewards.append(rollout_reward)
    if rewards:
      mean_rewards = np.mean(rewards)
    else:
      mean_rewards = 0
    return mean_rewards
docs: Calculate mean rewards from given epoch.