Skip to content

Commit 04c6c85

Browse files
authored
Fix indexing bug in LazyEvaluatedKernelTensor (#1819)
Seems to have been a copy&paste error
1 parent c58dc3a commit 04c6c85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gpytorch/lazy/lazy_evaluated_kernel_tensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ def _getitem(self, row_index, col_index, *batch_indices):
113113
# We're going to handle multi-batch indexing with a try-catch loop
114114
# This way - in the default case, we can avoid doing expansions of x1 which can be timely
115115
except IndexError:
116-
if any([not isinstance(bi, slice) for bi in batch_indices]):
116+
if any(not isinstance(bi, slice) for bi in batch_indices):
117117
raise RuntimeError(
118118
"Attempting to tensor index a non-batch matrix's batch dimensions. "
119119
f"Got batch index {batch_indices} but my shape was {self.shape}"
120120
)
121-
x2 = x2.expand(*([1] * (len(batch_indices) - self.x1.dim() + 2)), *self.x2.shape)
121+
x2 = x2.expand(*([1] * (len(batch_indices) - self.x2.dim() + 2)), *self.x2.shape)
122122
x2 = x2[(*batch_indices, col_index, dim_index)]
123123

124124
if len(batch_indices) == 0 or all(ind == slice(None, None, None) for ind in batch_indices):

0 commit comments

Comments
 (0)