42a0150c377485952c292a9057da2eaf6f41f2fc,fairseq/indexed_dataset.py,IndexedInMemoryDataset,__getitem__,#IndexedInMemoryDataset#Any#,94

Before Change


        pass

    def __getitem__(self, i):
        if i < 0 or i >= self.size:
            raise IndexError("index out of range")
        tensor_size = self.sizes[self.dim_offsets[i]:self.dim_offsets[i + 1]]
        a = np.empty(tensor_size, dtype=self.dtype)
        np.copyto(a, self.buffer[self.data_offsets[i]:self.data_offsets[i + 1]])
        return torch.from_numpy(a)

After Change


        pass

    def __getitem__(self, i):
        self.check_index(i)
        tensor_size = self.sizes[self.dim_offsets[i]:self.dim_offsets[i + 1]]
        a = np.empty(tensor_size, dtype=self.dtype)
        np.copyto(a, self.buffer[self.data_offsets[i]:self.data_offsets[i + 1]])
        return torch.from_numpy(a)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: pytorch/fairseq
Commit Name: 42a0150c377485952c292a9057da2eaf6f41f2fc
Time: 2017-11-08
Author: louismartin@users.noreply.github.com
File Name: fairseq/indexed_dataset.py
Class Name: IndexedInMemoryDataset
Method Name: __getitem__


Project Name: pytorch/fairseq
Commit Name: 42a0150c377485952c292a9057da2eaf6f41f2fc
Time: 2017-11-08
Author: louismartin@users.noreply.github.com
File Name: fairseq/indexed_dataset.py
Class Name: IndexedDataset
Method Name: __getitem__


Project Name: elbayadm/attn2d
Commit Name: 42a0150c377485952c292a9057da2eaf6f41f2fc
Time: 2017-11-08
Author: louismartin@users.noreply.github.com
File Name: fairseq/indexed_dataset.py
Class Name: IndexedInMemoryDataset
Method Name: __getitem__