Skip to content

Commit 379f746

Browse files
authored
Merge pull request #47 from ziatdinovmax/master
Update examples
2 parents d2f7cf3 + dcfd171 commit 379f746

File tree

2 files changed

+158
-179
lines changed

2 files changed

+158
-179
lines changed

atomai/models/dklgp/dklgpr.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Created by Maxim Ziatdinov (email: maxim.ziatdinov@ai4microscopy.com)
88
"""
99

10+
import warnings
1011
from typing import Tuple, Type, Union
1112

1213
import gpytorch
@@ -74,8 +75,11 @@ def _compute_posterior(self, X: torch.Tensor) -> gpytorch.distributions.Multivar
7475
"""
7576
self.gp_model.eval()
7677
self.likelihood.eval()
77-
with torch.no_grad(), gpytorch.settings.use_toeplitz(False), gpytorch.settings.fast_pred_var():
78-
posterior = self.gp_model(X.to(self.device))
78+
wrn = gpytorch.models.exact_gp.GPInputWarning
79+
with warnings.catch_warnings():
80+
warnings.filterwarnings("ignore", category=wrn)
81+
with torch.no_grad(), gpytorch.settings.use_toeplitz(False), gpytorch.settings.fast_pred_var():
82+
posterior = self.gp_model(X.to(self.device))
7983
return posterior
8084

8185
def sample_from_posterior(self, X, num_samples: int = 1000) -> np.ndarray:

examples/notebooks/atomai_dkl_ferroic.ipynb

Lines changed: 152 additions & 177 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)