提交 00501098 authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Iban Harlouchet

flake8 for theano/misc/gnumpy_utils.py

上级 03252057
...@@ -12,7 +12,7 @@ try: ...@@ -12,7 +12,7 @@ try:
___const_garray = gnumpy.rand(1) ___const_garray = gnumpy.rand(1)
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
if cuda.cuda_available == False: if cuda.cuda_available is False:
raise ImportError('Optional theano package cuda disabled') raise ImportError('Optional theano package cuda disabled')
def cudandarray_to_garray(x, copyif=False): def cudandarray_to_garray(x, copyif=False):
...@@ -38,7 +38,7 @@ try: ...@@ -38,7 +38,7 @@ try:
# Check if it is c contiguous # Check if it is c contiguous
size = 1 size = 1
c_contiguous = True c_contiguous = True
for i in range(x.ndim-1, -1, -1): for i in range(x.ndim - 1, -1, -1):
if x.shape[i] == 1: if x.shape[i] == 1:
continue continue
if x._strides[i] != size: if x._strides[i] != size:
...@@ -57,7 +57,7 @@ try: ...@@ -57,7 +57,7 @@ try:
# a cudamat object with no data_host. # a cudamat object with no data_host.
cm_mat = cudamat.cudamat() cm_mat = cudamat.cudamat()
cm_mat.size[0] = reduce(lambda x, y: x*y, x.shape, 1) cm_mat.size[0] = reduce(lambda x, y: x * y, x.shape, 1)
cm_mat.size[1] = 1 cm_mat.size[1] = 1
cm_mat.on_host = 0 cm_mat.on_host = 0
cm_mat.on_device = 1 cm_mat.on_device = 1
...@@ -72,8 +72,8 @@ try: ...@@ -72,8 +72,8 @@ try:
px._base = x # x won't be freed if the cudamat object isn't freed. px._base = x # x won't be freed if the cudamat object isn't freed.
px.mat_on_host = False # let cudamat know that we don't have a numpy # let cudamat know that we don't have a numpy array attached.
# array attached. px.mat_on_host = False
# Note how gnumpy tracks its cudamat objects: it moves things to the # Note how gnumpy tracks its cudamat objects: it moves things to the
# _cmsReuseCache when the gnumpy array is deleted, thus the arrays # _cmsReuseCache when the gnumpy array is deleted, thus the arrays
...@@ -100,7 +100,7 @@ try: ...@@ -100,7 +100,7 @@ try:
else: else:
strides = [1] strides = [1]
for i in x.shape[::-1][:-1]: for i in x.shape[::-1][:-1]:
strides.append(strides[-1]*i) strides.append(strides[-1] * i)
strides = strides[::-1] strides = strides[::-1]
for i in range(len(strides)): for i in range(len(strides)):
if x.shape[i] == 1: if x.shape[i] == 1:
......
...@@ -184,7 +184,6 @@ whitelist_flake8 = [ ...@@ -184,7 +184,6 @@ whitelist_flake8 = [
"scan_module/scan_opt.py", "scan_module/scan_opt.py",
"scan_module/tests/test_scan.py", "scan_module/tests/test_scan.py",
"scan_module/tests/test_scan_opt.py", "scan_module/tests/test_scan_opt.py",
"misc/gnumpy_utils.py",
"misc/may_share_memory.py", "misc/may_share_memory.py",
"misc/safe_asarray.py", "misc/safe_asarray.py",
"misc/pycuda_init.py", "misc/pycuda_init.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论