def feed(self, rewards, masks):
    rewards = np.reshape(rewards, [self.nenvs, self.nsteps])
    masks = np.reshape(masks, [self.nenvs, self.nsteps])
    for i in range(0, self.nenvs):
        for j in range(0, self.nsteps):
            self.episode_rewards[i].append(rewards[i][j])
            if masks[i][j]:
                l = len(self.episode_rewards[i])
                s = sum(self.episode_rewards[i])
                self.lenbuffer.append(l)
                self.rewbuffer.append(s)
                self.episode_rewards[i] = []
def feed(self, rewards, masks):
    rewards = np.reshape(rewards, [self.nenvs, self.nsteps])
    masks = np.reshape(masks, [self.nenvs, self.nsteps])
    for i in range(0, self.nenvs):
        for j in range(0, self.nsteps):
            self.episode_rewards[i].append(rewards[i][j])
            if masks[i][j]:
                l = len(self.episode_rewards[i])
                s = sum(self.episode_rewards[i])
                self.lenbuffer.append(l)
                self.rewbuffer.append(s)
                self.episode_rewards[i] = []