7384719699a07a5298c29f3205859b45533853ae,chainerrl/agents/dqn.py,DQN,act,#DQN#Any#,304

Before Change


        qout = self.model(self.batch_states([state], self.xp, self.phi),
                          test=True)
        action = cuda.to_cpu(qout.greedy_actions.data)[0]
        action_var = chainer.Variable(self.xp.asarray([action]))
        q = float(qout.evaluate_actions(action_var).data)

        // Update stats
        self.average_q *= self.average_q_decay
        self.average_q += (1 - self.average_q_decay) * q

After Change


            model.to_cpu()

    def act(self, state):
        with chainer.no_backprop_mode():
            action_value = self.model(
                self.batch_states([state], self.xp, self.phi), test=True)
            q = float(action_value.max.data)
            action = cuda.to_cpu(action_value.greedy_actions.data)[0]

        // Update stats
        self.average_q *= self.average_q_decay
        self.average_q += (1 - self.average_q_decay) * q

        self.logger.debug("t:%s q:%s action_value:%s", self.t, q, action_value)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: chainer/chainerrl
Commit Name: 7384719699a07a5298c29f3205859b45533853ae
Time: 2017-02-27
Author: muupan@gmail.com
File Name: chainerrl/agents/dqn.py
Class Name: DQN
Method Name: act


Project Name: chainer/chainerrl
Commit Name: 4e008e79147043207a5d0032aa771d7f811af0e1
Time: 2017-01-05
Author: muupan@gmail.com
File Name: chainerrl/agents/dqn.py
Class Name: DQN
Method Name: _compute_y_and_t


Project Name: explosion/thinc
Commit Name: f2754e0656d8cebe1f785f6af100e4ade241a7f8
Time: 2020-01-14
Author: honnibal+gh@gmail.com
File Name: thinc/model.py
Class Name: Model
Method Name: to_gpu


Project Name: chainer/chainerrl
Commit Name: 46ce3deaee16a50111a19e757fb90f6dbf747b89
Time: 2017-01-05
Author: muupan@gmail.com
File Name: chainerrl/agents/double_dqn.py
Class Name: DoubleDQN
Method Name: _compute_target_values