提交 482affdb authored 作者: Frederic's avatar Frederic

make theano init the gpu device before we make a CudaNdarraySharedVariable.

上级 1c9ac3df
......@@ -169,6 +169,12 @@ def cuda_shared_constructor(value, name=None, strict=False,
def float32_shared_constructor(value, name=None, strict=False,
allow_downcast=None, borrow=False, broadcastable=None):
"""SharedVariable Constructor for CudaNdarrayType from numpy.ndarray or CudaNdarray"""
if theano.sandbox.cuda.use.device_number is None:
theano.sandbox.cuda.use("gpu",
force=True,
default_to_move_computation_to_gpu=False,
move_shared_float32_to_gpu=False,
enable_cuda=False)
# if value isn't a float32 ndarray, or a CudaNdarray then raise
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论