uqfoundation/dill

tfp.math.psd_kernels.ExponentiatedQuadratic no longer serialiases with latest versions

Opened this issue · 0 comments

Until dill 0.3.5 it was possible to serialise a tensorflow-probability ExponentiatedQuadratic kernel:

import dill
import tensorflow_probability as tfp
kernel = tfp.math.psd_kernels.ExponentiatedQuadratic(1.0)
kernel_copy = dill.loads(dill.dumps(kernel)

As of 0.3.7 and 0.3.8 this now fails during unpicklig with:

E     NameError: name '_AutoCompositeTensorPsdKernelMeta' is not defined

Setting dill.settings['recurse'] = True changes the error message but doesn't fix it:

E       TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Tested with both tensorflow-probability==0.19.0 and tensorflow-probability==0.23.0 (though I don't think ExponentiatedQuadratic has changed recently).