ImportError: cannot import name as_cuda_ndarray_variable

216 views Asked by At

While I am trying to call as_cuda_ndarray_variable function from from theano.sandbox.cuda that is wrote on separate basic_ops.pypython file that is called inside the init.py file. My python-2.7.16 andtheano-0.9.0.

from theano.sandbox.cuda import as_cuda_ndarray_variable
ImportError: cannot import name as_cuda_ndarray_variable
2

There are 2 answers

1
Hadi GhahremanNezhad On

Maybe you can try this:

from theano.sandbox.cuda import * as cuda_ndarray_variable

or

import theano.sandbox.cuda as cuda_ndarray_variable
1
jlcope On

It appears that the function as_cuda_ndarray_variable is not defined directly within the theano.sandbox.cuda module. Try this instead:

from theano.sandbox.cuda import basic_ops

basic_ops.as_cuda_ndarray_variable(1.0)

See the example here: http://deeplearning.net/software/theano/tutorial/using_gpu.html