Skip to content

Commit 24da97d

Browse files
Merge branch 'main' into patch-13
2 parents a6e28d8 + c615d55 commit 24da97d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

gpytorch/models/exact_prediction_strategies.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ def get_fantasy_strategy(self, inputs, targets, full_inputs, full_targets, full_
531531
fant_noise = fant_likelihood.noise_covar(fant_wmat.transpose(-1, -2) if len(fant_wmat.shape) > 2 else fant_wmat)
532532
fant_root_vector = fant_noise.sqrt_inv_matmul(fant_wmat.transpose(-1, -2)).transpose(-1, -2)
533533

534+
# Ensure root decomposition exists before add_low_rank for efficient Woodbury updates.
535+
# This computes the root once (O(n³)), then subsequent fantasy updates use O(nk²) rank updates.
536+
_ = self.interp_inner_prod.root_decomposition(method="cholesky")
534537
new_wmat = self.interp_inner_prod.add_low_rank(fant_root_vector.to_dense())
535538
mean_diff = (targets - fant_mean).unsqueeze(-1)
536539
new_interp_response_cache = self.interp_response_cache + fant_wmat.matmul(fant_noise.solve(mean_diff))

0 commit comments

Comments
 (0)