99153ad034108b7d0e759fc246cb3d05593ee897,texar/agents/pg_agent.py,PGAgent,_train_policy,#PGAgent#Any#,136

Before Change


        Args:
            TODO
        
        discount_factor = self._hparams.discount_factor
        qvalues = list(self._rewards)
        max_seq_length = len(qvalues)
        if max_seq_length >= 2:
            for i in range(max_seq_length - 2, -1, -1):
                qvalues[i] += discount_factor * qvalues[i + 1]

        q_mean = np.mean(qvalues)
        q_std = np.std(qvalues)
        qvalues = [(q - q_mean) / q_std for q in qvalues]

After Change


        qvalues = discount_reward(
            [self._rewards], discount=self._hparams.discount_factor,
            normalize=self._hparams.normalize_reward)
        qvalues = qvalues[0, :]

        fetches = dict(loss=self._train_op)
        feed_dict_ = {
            self._observ_inputs: self._observs,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: asyml/texar
Commit Name: 99153ad034108b7d0e759fc246cb3d05593ee897
Time: 2018-06-02
Author: zhitinghu@gmail.com
File Name: texar/agents/pg_agent.py
Class Name: PGAgent
Method Name: _train_policy


Project Name: keras-team/keras
Commit Name: efe5916109e220a429a2cff110edb952d747466f
Time: 2016-04-01
Author: francois.chollet@gmail.com
File Name: tests/keras/layers/test_convolutional.py
Class Name:
Method Name: test_averagepooling_2d


Project Name: maciejkula/spotlight
Commit Name: bc51dbc0c56f68ed30857755026633f78eef1ae8
Time: 2017-08-20
Author: maciej.kula@gmail.com
File Name: spotlight/layers.py
Class Name: BloomEmbedding
Method Name: forward