f76a4dabb4cd38ee58d01a35c5b511e224d060d2,gpytorch/lazy/sum_batch_lazy_tensor.py,SumBatchLazyTensor,_get_indices,#SumBatchLazyTensor#Any#Any#,99

Before Change


        raise RuntimeError("Batch get indices is not implmeneted yet")

    def _get_indices(self, left_indices, right_indices):
        batch_indices = self.tensor_cls(self.batch_size()).long()
        torch.arange(0, self.batch_size(), out=batch_indices.data)
        batch_indices = batch_indices.unsqueeze(1).repeat(1, len(left_indices)).view(-1)
        left_indices = left_indices.unsqueeze(1).repeat(self.batch_size(), 1).view(-1)
        right_indices = right_indices.unsqueeze(1).repeat(self.batch_size(), 1).view(-1)

After Change


        return res

    def _get_indices(self, left_indices, right_indices):
        batch_indices = torch.arange(0, self.base_lazy_tensor.size(0), dtype=torch.long, device=left_indices.device)
        batch_indices = batch_indices.unsqueeze(1).repeat(1, len(left_indices)).view(-1)
        left_indices = left_indices.unsqueeze(1).repeat(self.base_lazy_tensor.size(0), 1).view(-1)
        right_indices = right_indices.unsqueeze(1).repeat(self.base_lazy_tensor.size(0), 1).view(-1)
        res = self.base_lazy_tensor._batch_get_indices(batch_indices, left_indices, right_indices)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: cornellius-gp/gpytorch
Commit Name: f76a4dabb4cd38ee58d01a35c5b511e224d060d2
Time: 2018-09-17
Author: gpleiss@gmail.com
File Name: gpytorch/lazy/sum_batch_lazy_tensor.py
Class Name: SumBatchLazyTensor
Method Name: _get_indices


Project Name: allenai/allennlp
Commit Name: 2dd335e4faad78a04c1028e6f048b65143399c40
Time: 2020-08-25
Author: ohadr@mail.tau.ac.il
File Name: allennlp/nn/util.py
Class Name:
Method Name: batched_span_select


Project Name: NVIDIA/sentiment-discovery
Commit Name: 65c9a4857e41dcde4f5dae8a77e6cdf03953646a
Time: 2018-03-19
Author: raulp@dbcluster.nvidia.com
File Name: model/model.py
Class Name: RNNFeaturizer
Method Name: forward


Project Name: pytorch/pytorch
Commit Name: d30f4d1dfd5237d89834363ce2cff9de4ee92811
Time: 2021-03-03
Author: 24860335+xwang233@users.noreply.github.com
File Name: torch/nn/modules/_functions.py
Class Name: SyncBatchNorm
Method Name: forward