Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gpytorch/mlls/leave_one_out_pseudo_likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def forward(self, function_dist: MultivariateNormal, target: Tensor, *params) ->
:param torch.Tensor target: :math:`\mathbf y` The target values
:param dict kwargs: Additional arguments to pass to the likelihood's forward function.
"""
target = target.flatten()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause errors if target is a batch of targets.

Please also add unit tests, covering both the batch and the non-batch case. Ideally, your tests should catch the error that you are trying to fix. I.e. you should have unit tests that fail before you add your code change, but pass after you add your code change.

output = self.likelihood(function_dist, *params)
m, L = output.mean, output.lazy_covariance_matrix.cholesky(upper=False)
m = m.reshape(*target.shape)
Expand Down