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

[Bug] IndexKernel with empty input #2530

Open
AdrianSosic opened this issue Jun 5, 2024 · 0 comments
Open

[Bug] IndexKernel with empty input #2530

AdrianSosic opened this issue Jun 5, 2024 · 0 comments
Labels

Comments

@AdrianSosic
Copy link

🐛 Bug

The IndexKernel seems broken for the case when the input is empty. I stumbled upon this issue when working with botorch (see corresponding bug report here).

To reproduce

** Code snippet to reproduce **

import torch
from gpytorch.kernels import IndexKernel

k = IndexKernel(num_tasks=2)
t = torch.tensor([])
k(t, t)

** Stack trace/error message **

ZeroDivisionError: integer division or modulo by zero

Expected Behavior

The output should simply be tensor([], size=(0, 0)), just like you would get it for other kernels. For example, the following snippet works without problems:

import torch
from gpytorch.kernels import MaternKernel

k = MaternKernel()
t = torch.tensor([])
k(t, t)

System information

Please complete the following information:

  • GPyTorch Version: 1.11
  • PyTorch Version: 2.3.0
  • OS: macOS
@AdrianSosic AdrianSosic added the bug label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant