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: 9

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: keras-team/keras
Commit Name: 023331ec2a7b0086abfc81eca16c84a1692ee653
Time: 2017-02-09
Author: francois.chollet@gmail.com
File Name: keras/layers/convolutional.py
Class Name: Convolution2D
Method Name: build


Project Name: stellargraph/stellargraph
Commit Name: 145170ca9bbd89aa01d8a40841e3c039d3683af8
Time: 2019-06-03
Author: andrew.docherty@data61.csiro.au
File Name: stellargraph/layer/graph_attention.py
Class Name: GraphAttention
Method Name: call