Closed fabioramos closed 5 years ago
Hi, could you please provide the full code to reproduce the error? In particular where g and x_test come from?
My simulator is more complicated but even the standard simulator creates the error:
from delfi.simulator import GaussMixture
n_params = 1 m = GaussMixture(dim=n_params)
import delfi.distribution as dd import numpy as np p = dd.Uniform(lower=[-10], upper=[10])
from delfi.summarystats import Identity s = Identity()
from delfi.generator import Default g = Default(model=m, prior=p, summary=s)
params, stats = g.gen(500) xo = np.array([[0.]])
from delfi.inference import Basic, CDELFI
inf_basic = CDELFI(generator=g, obs=xo, n_components=5, prior_norm = False, n_hiddens=[24, 24], svi=True)
log, traindata, = inf_basic.run(n_train=1000)
TypeError Traceback (most recent call last)
params
, stats
, and xo
are of dtype np.float64
. Computing with float64 on the GPU backend is tricky. You'll get rid of the error by converting your arrays to np.float32
or using the floatX
setting (see below).
The backend supports all regular theano data types (float32, float64, int, ...), however GPU support varies and some units can’t deal with double (float64) or small (less than 32 bits like int16) data types. You will get an error at compile time or runtime if this is the case.
The more float32, the better GPU performance you will get.
Consider adding floatX=float32 (or the type you are using) to your .theanorc file if you plan to do a lot of GPU work.
See: http://deeplearning.net/software/theano/tutorial/using_gpu.html
Thank you for this excellent implementation of Papamakarios and Murray's paper on likelihood free inference. I'm having an issue running the code with more than two components, for example:
Returns:
TypeError: ('GpuArrayType<None>(float32, matrix) cannot store a value of dtype float64 without risking loss of precision.', 'Container name "None"')
This does not happen for only one component in the mixture. Any ideas?
Thanks!