3d9e51d5034e89bcec3a04eff3e646c70b45edb2,classify/python/tf/train.py,Trainer,train,#Trainer#Any#Any#Any#,43

Before Change


            ts_i = data.batch(ts, si, batchsz)
            feed_dict = self.model.ex2dict(ts_i, 1.0-dropout)
        
            _, step, summary_str, lossv, accv = self.sess.run([self.train_op, self.global_step, self.summary_op, self.loss, self.acc], feed_dict=feed_dict)
            self.train_writer.add_summary(summary_str, step)
        
            total_corr += accv
            total_loss += lossv

After Change


        total_corr = cm.get_correct()
        duration = time.time() - start_time

        print("Train (Loss %.4f) (Acc %d/%d = %.4f) (%.3f sec)" % (float(total_loss)/total, total_corr, total, float(total_corr)/total, duration))
        print(cm)

    def test(self, ts, cm, batchsz=1, phase="Test"):

        total_loss = 0
        start_time = time.time()
        steps = int(math.floor(len(ts)/float(batchsz)))
        cm.reset()
        for i in range(steps):
            
            ts_i = data.batch(ts, i, batchsz)
            
            feed_dict = self.model.ex2dict(ts_i, 1)
            lossv, guess = self.sess.run([self.loss, self.model.best], feed_dict=feed_dict)
            cm.add_batch(ts_i.y, guess)
            total_loss += lossv

        total = cm.get_total()
        total_corr = cm.get_correct()
        
        duration = time.time() - start_time
        print("%s (Loss %.4f) (Acc %d/%d = %.4f) (%.3f sec)" % (phase, float(total_loss)/total, total_corr, total, float(total_corr)/total, duration))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 13

Instances


Project Name: dpressel/mead-baseline
Commit Name: 3d9e51d5034e89bcec3a04eff3e646c70b45edb2
Time: 2017-03-16
Author: dpressel@gmail.com
File Name: classify/python/tf/train.py
Class Name: Trainer
Method Name: train


Project Name: dpressel/mead-baseline
Commit Name: 3d9e51d5034e89bcec3a04eff3e646c70b45edb2
Time: 2017-03-16
Author: dpressel@gmail.com
File Name: classify/python/tf/train.py
Class Name: Trainer
Method Name: train


Project Name: tensorlayer/tensorlayer
Commit Name: 641a28fbf0daff0ad1ad0f43d2c4b545cb6f9656
Time: 2019-02-16
Author: dhsig552@163.com
File Name: examples/reinforcement_learning/tutorial_cartpole_ac.py
Class Name: Actor
Method Name: learn


Project Name: tensorlayer/tensorlayer
Commit Name: 641a28fbf0daff0ad1ad0f43d2c4b545cb6f9656
Time: 2019-02-16
Author: dhsig552@163.com
File Name: examples/reinforcement_learning/tutorial_cartpole_ac.py
Class Name: Critic
Method Name: learn