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

flake8 for theano/misc/gnumpy_utils.py

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