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

Allow pickle of IndexKernels #2482

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TobyBoyne
Copy link

Currently, index kernels cannot be pickled. This PR moves an anonymous function to the module-level to allow pickling.

Current behaviour is that index kernels with a prior throw an error when pickling.

from gpytorch.kernels import IndexKernel
from gpytorch.priors import LKJPrior
import pickle

kernel = IndexKernel(2, prior=LKJPrior(2, 1))
pickle.dumps(kernel)

This throws
> AttributeError: Can't pickle local object 'IndexKernel.__init__.<locals>.<lambda>'

There isn't an open issue for this in particular, but there is a request for pickle-able kernels. (#907, #2264)

Copy link
Collaborator

@Balandat Balandat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants