Skip to content

Commit 9fea889

Browse files
Balandatfacebook-github-bot
authored andcommitted
Do not construct full covarince for single-output models (#185)
Summary: Pull Request resolved: #185 Currently we unnecessarily construct the full covariance matrix when computing the posterior of a `BatchedMultiOutputGPyTorchModel`. This is a quick fix to avoid doing that for single-output models, the case for multi-output models will require some more thought. Reviewed By: sdaulton Differential Revision: D16001819 fbshipit-source-id: c9a2dee886f1b3f6381c7a81822a46f2f8bffd0d
1 parent a46b964 commit 9fea889

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

botorch/models/gpytorch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ def posterior(
187187
mvn = self(X)
188188
if observation_noise:
189189
mvn = self.likelihood(mvn, X)
190-
mean_x = mvn.mean
191-
covar_x = mvn.covariance_matrix
192190
if self._num_outputs > 1:
191+
mean_x = mvn.mean
192+
covar_x = mvn.covariance_matrix
193193
output_indices = output_indices or range(self._num_outputs)
194194
mvns = [
195195
MultivariateNormal(

0 commit comments

Comments
 (0)