提交 ea0d5af8 authored 作者: cai-lw's avatar cai-lw

Manually set cuda_ndarray.__file__ if it is absent

Python 3 does not necessarily set __file__ when importing, and it happens that it is not set on my system (Windows 10, Python 3.4) and causes an exception.
上级 2fe88f36
...@@ -21,6 +21,11 @@ try: ...@@ -21,6 +21,11 @@ try:
import cuda_ndarray.cuda_ndarray as cuda import cuda_ndarray.cuda_ndarray as cuda
from theano.sandbox.cuda.nvcc_compiler import NVCC_compiler from theano.sandbox.cuda.nvcc_compiler import NVCC_compiler
import cuda_ndarray import cuda_ndarray
# Python 3 does not necessarily set __file__. May need manual setting
try:
cuda_ndarray.__file__
except AttributeError:
cuda_ndarray.__file__ = os.path.join(cuda_ndarray.__path__._path[0], 'cuda_ndarray.pyd')
except ImportError: except ImportError:
# Used to know that `cuda` could not be properly imported. # Used to know that `cuda` could not be properly imported.
cuda = None cuda = None
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论