cornellius-gp / gpytorch

A highly efficient implementation of Gaussian Processes in PyTorch
MIT License
3.54k stars 557 forks source link

Fix lazy kernel slicing when there are multiple outputs #2376

Closed douglas-boubert closed 1 year ago

douglas-boubert commented 1 year ago

Fixes a bug when slicing a lazy kernel and the number of outputs per row or column is greater than one.

The master implementation incorrectly checks to see if x1 and x2 are both slices. This always fails and defaults to the super method.

This PR fixes that check to ensure that row_index and col_index are slices.

The changes on the other lines are necessary to catch situations where the start point or end point of the slicing is implicit.

douglas-boubert commented 1 year ago

@Balandat, thanks for the review! I've simplified the None start/stop filling and added a unittest that covers the behaviour.

Balandat commented 1 year ago

Looks like the linter / code formatter is unhappy, other than that this lgtm

douglas-boubert commented 1 year ago

Looks like the linter / code formatter is unhappy, other than that this lgtm

Ah, sorry for that! I've run ufmt on both files I touched and pushed the changes.