Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reshape Targets and Mean for RHS in Cholesky solver #2587

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion gpytorch/models/exact_prediction_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def get_fantasy_strategy(self, inputs, targets, full_inputs, full_targets, full_
prefix = string.ascii_lowercase[: max(fant_train_covar.dim() - self.mean_cache.dim() - 1, 0)]
ftcm = torch.einsum(prefix + "...yz,...z->" + prefix + "...y", [fant_train_covar, self.mean_cache])

small_system_rhs = targets - fant_mean - ftcm
targets_ = torch.reshape(targets, (-1, ftcm.shape[-1]))
fant_mean_ = torch.reshape(fant_mean, (-1, ftcm.shape[-1]))
small_system_rhs = targets_ - fant_mean_ - ftcm
small_system_rhs = small_system_rhs.unsqueeze(-1)
# Schur complement of a spd matrix is guaranteed to be positive definite
schur_cholesky = psd_safe_cholesky(schur_complement)
Expand Down