2381a50a70559340a0335288d648b4bb9a675588,slm_lab/agent/algorithm/dqn.py,MultitaskDQN,act,#MultitaskDQN#Any#,314

Before Change


        state_a = np.array(new_data, dtype=np.float).flatten()

        state = torch.from_numpy(state_a).float().unsqueeze_(dim=0)
        if torch.cuda.is_available() and self.net_spec["gpu"]:
            state = state.cuda()
        pdparam = self.calc_pdparam(state, evaluate=False)
        // use multi-policy. note arg change

After Change


        """Non-atomizable act to override agent.act(), do a single pass on the entire state_a instead of composing body_act"""
        // gather and flatten
        states = []
        for (e, b), body in util.ndenumerate_nonan(self.agent.body_a):
            state = state_a[(e, b)]
            states.append(state)
        state = torch.tensor(states).view(-1).unsqueeze_(0).float()
        if torch.cuda.is_available() and self.net.gpu:
            state = state.cuda()
        pdparam = self.calc_pdparam(state, evaluate=False)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

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/dqn.py
Class Name: MultitaskDQN
Method Name: act


Project Name: kengz/SLM-Lab
Commit Name: 8c17debc9dc6552da8c317c0c852b55f03c80c61
Time: 2017-12-24
Author: kengzwl@gmail.com
File Name: slm_lab/env/__init__.py
Class Name: OpenAIEnv
Method Name: step


Project Name: kengz/SLM-Lab
Commit Name: aa4ae658489c919dbca4141c7498b05ac0cac6d8
Time: 2019-05-25
Author: kengzwl@gmail.com
File Name: slm_lab/agent/__init__.py
Class Name: AgentSpace
Method Name: act