2381a50a70559340a0335288d648b4bb9a675588,slm_lab/agent/algorithm/actor_critic.py,ActorCritic,train_separate,#ActorCritic#,247

Before Change


            batch = self.sample()
            logger.debug3(f"Batch states: {batch["states"]}")
            critic_loss = self.train_critic(batch)
            actor_loss = self.train_actor(batch)
            total_loss = critic_loss + abs(actor_loss)
            logger.debug("Losses: Critic: {:.2f}, Actor: {:.2f}, Total: {:.2f}".format(
                critic_loss, abs(actor_loss), total_loss
            ))
            return total_loss.item()
        else:
            return np.nan

    def train_critic(self, batch):

After Change


            self.body.entropies = []
            self.body.log_probs = []
            logger.debug(f"Total loss: {loss:.2f}")
            self.last_loss = loss.item()
        return self.last_loss

    def train_actor(self, advs):
        """Trains the actor when the actor and critic are separate networks"""
        policy_loss = self.calc_policy_loss(advs)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: kengz/SLM-Lab
Commit Name: 2381a50a70559340a0335288d648b4bb9a675588
Time: 2018-06-12
Author: kengzwl@gmail.com
File Name: slm_lab/agent/algorithm/actor_critic.py
Class Name: ActorCritic
Method Name: train_separate


Project Name: kengz/SLM-Lab
Commit Name: 2381a50a70559340a0335288d648b4bb9a675588
Time: 2018-06-12
Author: kengzwl@gmail.com
File Name: slm_lab/agent/algorithm/dqn.py
Class Name: HydraDQN
Method Name: train


Project Name: rusty1s/pytorch_geometric
Commit Name: 776f891afa3e7bfe2ae456c064e0867c4987c762
Time: 2020-06-30
Author: matthias.fey@tu-dortmund.de
File Name: examples/rgcn.py
Class Name:
Method Name: test


Project Name: rusty1s/pytorch_geometric
Commit Name: 2578ba8b844bdceb9333fa73a909b2aa9436f867
Time: 2020-06-30
Author: luca.cavallery@gmail.com
File Name: examples/pna.py
Class Name:
Method Name: train