4ee4c9129a0006abc2e475bb63039d2bdb97153f,python/magent/builtin/mx_model/a2c.py,AdvantageActorCritic,infer_action,#AdvantageActorCritic#Any#Any#Any#Any#,108

Before Change


        n = len(view)

        ret = np.empty(n, dtype=np.int32)
        with self.ctx:
            self._reset_bind_size(n)
            data_batch = mx.io.DataBatch(data=[mx.nd.array(view), mx.nd.array(feature)])
            self.model.forward(data_batch, is_train=False)
            policy = self.model.get_outputs()[3].asnumpy()

            actions = np.arange(self.num_actions)
            for i in range(n):
                ret[i] = np.random.choice(actions, p=policy[i])
        return ret

    def train(self, sample_buffer, print_every=1000):
        // calc buffer size

After Change


        n = len(view)

        ret = np.empty(n, dtype=np.int32)
        self._reset_bind_size(n)
        data_batch = mx.io.DataBatch(data=[mx.nd.array(view), mx.nd.array(feature)])
        self.model.forward(data_batch, is_train=False)
        policy = self.model.get_outputs()[3].asnumpy()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: geek-ai/MAgent
Commit Name: 4ee4c9129a0006abc2e475bb63039d2bdb97153f
Time: 2017-11-24
Author: zhenglianmin96@163.com
File Name: python/magent/builtin/mx_model/a2c.py
Class Name: AdvantageActorCritic
Method Name: infer_action


Project Name: geek-ai/MAgent
Commit Name: 4ee4c9129a0006abc2e475bb63039d2bdb97153f
Time: 2017-11-24
Author: zhenglianmin96@163.com
File Name: python/magent/builtin/mx_model/a2c.py
Class Name: AdvantageActorCritic
Method Name: train


Project Name: geek-ai/MAgent
Commit Name: d15a15df582f43d9bc65a434db0d64c9e276b724
Time: 2017-11-23
Author: zhenglianmin96@163.com
File Name: python/magent/builtin/mx_model/dqn.py
Class Name: DeepQNetwork
Method Name: train