提交 103e51ef authored 作者: Frederic's avatar Frederic

Remove import of device_properties at the top of the file, as this break import…

Remove import of device_properties at the top of the file, as this break import of Theano when there is no GPU available.
上级 1feb53a7
...@@ -18,7 +18,6 @@ from theano.scan_module import scan_utils, scan_op, scan_opt ...@@ -18,7 +18,6 @@ from theano.scan_module import scan_utils, scan_op, scan_opt
from theano.gof.python25 import all, any from theano.gof.python25 import all, any
from theano.tensor.nnet.conv import ConvOp from theano.tensor.nnet.conv import ConvOp
from theano.sandbox.cuda.basic_ops import device_properties
from theano.sandbox.gpuarray.type import GpuArrayType from theano.sandbox.gpuarray.type import GpuArrayType
from theano.sandbox.gpuarray.basic_ops import ( from theano.sandbox.gpuarray.basic_ops import (
host_from_gpu, gpu_from_host, HostFromGpu, host_from_gpu, gpu_from_host, HostFromGpu,
...@@ -294,6 +293,8 @@ def local_gpua_advanced_incsubtensor(node): ...@@ -294,6 +293,8 @@ def local_gpua_advanced_incsubtensor(node):
coords = node.inputs[2:] coords = node.inputs[2:]
set_instead_of_inc = node.op.set_instead_of_inc set_instead_of_inc = node.op.set_instead_of_inc
active_device_no = theano.sandbox.cuda.active_device_number() active_device_no = theano.sandbox.cuda.active_device_number()
device_properties = theano.sandbox.cuda.device_properties
compute_capability = device_properties(active_device_no)['major'] compute_capability = device_properties(active_device_no)['major']
if (compute_capability < 2 or x.ndim != 2 or y.ndim != 2): if (compute_capability < 2 or x.ndim != 2 or y.ndim != 2):
......
...@@ -7,7 +7,6 @@ from theano import tensor, gof, Op ...@@ -7,7 +7,6 @@ from theano import tensor, gof, Op
from theano.gof.python25 import all, any from theano.gof.python25 import all, any
from theano.tensor.subtensor import IncSubtensor, Subtensor, get_idx_list from theano.tensor.subtensor import IncSubtensor, Subtensor, get_idx_list
import theano.tensor.inplace import theano.tensor.inplace
from theano.sandbox.cuda.basic_ops import device_properties
from theano.sandbox.cuda.nvcc_compiler import NVCC_compiler from theano.sandbox.cuda.nvcc_compiler import NVCC_compiler
try: try:
...@@ -489,6 +488,7 @@ class GpuAdvancedIncSubtensor1_dev20(GpuAdvancedIncSubtensor1): ...@@ -489,6 +488,7 @@ class GpuAdvancedIncSubtensor1_dev20(GpuAdvancedIncSubtensor1):
def c_code(self, node, name, inputs, outputs, sub): def c_code(self, node, name, inputs, outputs, sub):
active_device_no = theano.sandbox.cuda.active_device_number() active_device_no = theano.sandbox.cuda.active_device_number()
device_properties = theano.sandbox.cuda.device_properties
compute_capability = device_properties(active_device_no)['major'] compute_capability = device_properties(active_device_no)['major']
if ((self.set_instead_of_inc) or if ((self.set_instead_of_inc) or
(node.inputs[0].ndim != node.inputs[1].ndim) or (node.inputs[0].ndim != node.inputs[1].ndim) or
......
...@@ -29,6 +29,7 @@ if cuda_available: ...@@ -29,6 +29,7 @@ if cuda_available:
from theano.sandbox.gpuarray.basic_ops import GpuKernelBase from theano.sandbox.gpuarray.basic_ops import GpuKernelBase
from theano.sandbox.gpuarray.type import GpuArrayType from theano.sandbox.gpuarray.type import GpuArrayType
def matVecModM(A, s, m): def matVecModM(A, s, m):
assert A.dtype == 'int64' assert A.dtype == 'int64'
return numpy.int32(numpy.sum((A*s) % m, 1) % m) return numpy.int32(numpy.sum((A*s) % m, 1) % m)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论