You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by Turakar March 12, 2023
I am trying to get a VNNGP to work in a batched setting. To this end, I tried the following code, which is based on the tutorial.
However, this does not work, as the _stochastic_kl_helper() in NNVariationalStrategy calls forward() of the covar_module with an input of shape (4, 25, 25, 1), while a shape of (4, n, 1) is expected. Did I get something wrong about the usage of NNVariationalStrategy or is there something wrong in GPyTorch? This is the exact stacktrace:
Traceback (most recent call last):
File "/path/to/gpytorch/snippet_variational_batch_sogp.py", line 109, in <module>
main()
File "/path/to/gpytorch/snippet_variational_batch_sogp.py", line 71, in main
output = model(x=None)
File "/path/to/gpytorch/snippet_variational_batch_sogp.py", line 40, in __call__
return self.variational_strategy(x=x, prior=False, **kwargs)
File "/path/to/gpytorch/gpytorch/variational/nearest_neighbor_variational_strategy.py", line 131, in __call__
return self.forward(x, self.inducing_points, None, None)
File "/path/to/gpytorch/gpytorch/variational/nearest_neighbor_variational_strategy.py", line 168, in forward
kl = self._kl_divergence(kl_indices)
File "/path/to/gpytorch/gpytorch/variational/nearest_neighbor_variational_strategy.py", line 325, in _kl_divergence
kl = self._stochastic_kl_helper(kl_indices) * self.M / len(kl_indices)
File "/path/to/gpytorch/gpytorch/variational/nearest_neighbor_variational_strategy.py", line 273, in _stochastic_kl_helper
cov = self.model.covar_module.forward(nearest_neighbors, nearest_neighbors)
File "/path/to/gpytorch/gpytorch/kernels/scale_kernel.py", line 109, in forward
orig_output = self.base_kernel.forward(x1, x2, diag=diag, last_dim_is_batch=last_dim_is_batch, **params)
File "/path/to/gpytorch/gpytorch/kernels/rbf_kernel.py", line 80, in forward
return RBFCovariance.apply(
File "/path/to/gpytorch/gpytorch/functions/rbf_covariance.py", line 12, in forward
x1_ = x1.div(lengthscale)
RuntimeError: The size of tensor a (25) must match the size of tensor b (4) at non-singleton dimension 1
Does somebody have an idea what's going on here? Maybe @LuhuanWu or @gpleiss ?
The text was updated successfully, but these errors were encountered:
Discussed in #2300
Originally posted by Turakar March 12, 2023
I am trying to get a VNNGP to work in a batched setting. To this end, I tried the following code, which is based on the tutorial.
However, this does not work, as the
_stochastic_kl_helper()
inNNVariationalStrategy
callsforward()
of thecovar_module
with an input of shape(4, 25, 25, 1)
, while a shape of(4, n, 1)
is expected. Did I get something wrong about the usage ofNNVariationalStrategy
or is there something wrong in GPyTorch? This is the exact stacktrace:Does somebody have an idea what's going on here? Maybe @LuhuanWu or @gpleiss ?
The text was updated successfully, but these errors were encountered: