Newmu / dcgan_code

Deep Convolutional Generative Adversarial Networks
MIT License
3.44k stars 694 forks source link

CudaNdarrayType only supports dtype float32 for now #9

Closed genekogan closed 8 years ago

genekogan commented 8 years ago

In the mnist training code, i get the following traceback. looks like a CUDA versioning issue? do i need to upgrade CUDA or is there some way around this?

gX = gen(Z, Y, *gen_params)

Traceback (most recent call last): File "", line 1, in File "", line 9, in gen File "lib/ops.py", line 90, in deconv img = gpu_contiguous(X) File "/Users/gene/anaconda/lib/python2.7/site-packages/theano/gof/op.py", line 509, in call node = self.make_node(_inputs, _kwargs) File "/Users/gene/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/basic_ops.py", line 3806, in make_node input = as_cuda_ndarray_variable(input) File "/Users/gene/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/basic_ops.py", line 47, in as_cuda_ndarray_variable return gpu_from_host(tensor_x) File "/Users/gene/anaconda/lib/python2.7/site-packages/theano/gof/op.py", line 509, in call node = self.make_node(_inputs, _kwargs) File "/Users/gene/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/basic_ops.py", line 139, in make_node dtype=x.dtype)()]) File "/Users/gene/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/type.py", line 70, in init (self.class.name, dtype, name)) TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None

Newmu commented 8 years ago

Have you made sure theano.config.floatX is set to float32? The debug msg is suggesting symbolic variable going into a conv or deconv op (likely a downstream from "Z" or "Y") has dtype float64. Check Z.dtype and Y.dtype

genekogan commented 8 years ago

yes! that solved that problem. however it led to a new issue (HostFromGPU not defined, see below). thanks for the repo, results look really amazing. sorry, still getting the hang of theano...

>> gX = gen(Z, Y, *gen_params)

Traceback (most recent call last): File "", line 1, in File "", line 9, in gen File "lib/ops.py", line 63, in batchnorm b_u = T.mean(X, axis=[0, 2, 3]).dimshuffle('x', 0, 'x', 'x') File "/usr/local/lib/python2.7/dist-packages/theano/tensor/basic.py", line 2864, i n mean acc_dtype=acc_dtype) File "/usr/local/lib/python2.7/dist-packages/theano/tensor/basic.py", line 2726, i n sum out = elemwise.Sum(axis=axis, dtype=dtype, acc_dtype=acc_dtype)(input) File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 509, in cal l node = self.make_node(_inputs, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/theano/tensor/elemwise.py", line 1852 , in make_node input = as_tensor_variable(input) File "/usr/local/lib/python2.7/dist-packages/theano/tensor/basic.py", line 146, in as_tensor_variable return x._as_TensorVariable() # TODO: pass name and ndim arguments File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/var.py", line 32, in _as_TensorVariable return HostFromGpu()(self) NameError: global name 'HostFromGpu' is not defined

Newmu commented 8 years ago

Usually only seen an error like that when you don't have cuda/cudnn properly installed/configured. Can you confirm cuda/cudnn is working on your end?

genekogan commented 8 years ago

yes, works perfectly now, thank you! i had cuda/cudnn installed, just didn't have it in the PATH.