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)
🐛 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
Stack trace/error message
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:System information
Please complete the following information: