提交 94059e32 authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Iban Harlouchet

flake8 for theano/misc/may_share_memory.py

上级 00501098
......@@ -3,8 +3,6 @@ Function to detect memory sharing for ndarray AND sparse type AND CudaNdarray.
numpy version support only ndarray.
"""
__docformat__ = "restructuredtext en"
import numpy
from theano.tensor.basic import TensorType
......@@ -20,6 +18,8 @@ except ImportError:
return False
from theano.sandbox import cuda
from theano.sandbox import gpuarray
if cuda.cuda_available:
from theano.sandbox.cuda.type import CudaNdarrayType
......@@ -29,8 +29,9 @@ else:
def _is_cuda(a):
return False
__docformat__ = "restructuredtext en"
from theano.sandbox import gpuarray
if gpuarray.pygpu:
def _is_gpua(a):
return isinstance(a, gpuarray.pygpu.gpuarray.GpuArray)
......@@ -56,7 +57,7 @@ def may_share_memory(a, b, raise_other_type=True):
a_sparse = _is_sparse(a)
b_sparse = _is_sparse(b)
if (not(a_ndarray or a_sparse or a_cuda or a_gpua) or
not(b_ndarray or b_sparse or b_cuda or b_gpua)):
not(b_ndarray or b_sparse or b_cuda or b_gpua)):
if raise_other_type:
raise TypeError("may_share_memory support only ndarray"
" and scipy.sparse, CudaNdarray or GpuArray type")
......
......@@ -184,7 +184,6 @@ whitelist_flake8 = [
"scan_module/scan_opt.py",
"scan_module/tests/test_scan.py",
"scan_module/tests/test_scan_opt.py",
"misc/may_share_memory.py",
"misc/safe_asarray.py",
"misc/pycuda_init.py",
"misc/check_duplicate_key.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论