f2cfa5fb8e73229a1757acbcc94bab13099de439,PyPi/utils/spaces.py,MultiDiscrete,get_idx,#MultiDiscrete#Any#,84

Before Change



    def get_idx(self, value):
        idx = list()
        for s, v in enumerate(value):
            idx.append(np.argwhere(
                self.discrete_spaces[s].values == v).ravel()[0])

        return idx

After Change


        return np.array(values)

    def get_idx(self, value):
        if value.ndim == 1:
            idxs = [
                self.discrete_spaces[i]._idxs[v] for i, v in enumerate(value)]
        elif value.ndim == 2:
            idxs = list()
            for v in value:
                idx = [
                    self.discrete_spaces[i]._idxs[v1] for i, v1 in enumerate(v)]
                idxs.append(idx)
        else:
            raise ValueError("Wrong dimension for indices array.")

        return np.array(idxs)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: AIRLab-POLIMI/mushroom
Commit Name: f2cfa5fb8e73229a1757acbcc94bab13099de439
Time: 2017-06-05
Author: carlo.deramo@gmail.com
File Name: PyPi/utils/spaces.py
Class Name: MultiDiscrete
Method Name: get_idx


Project Name: AIRLab-POLIMI/mushroom
Commit Name: f2cfa5fb8e73229a1757acbcc94bab13099de439
Time: 2017-06-05
Author: carlo.deramo@gmail.com
File Name: PyPi/utils/spaces.py
Class Name: MultiDiscrete
Method Name: get_value


Project Name: facebookresearch/ParlAI
Commit Name: c23e2307b9b2e0147ef4699b2b5bbabdac08a0fc
Time: 2019-12-03
Author: roller@fb.com
File Name: parlai/core/torch_generator_agent.py
Class Name: TreeSearch
Method Name: advance