提交 0bdc9521 authored 作者: Iban Harlouchet's avatar Iban Harlouchet

flake8 of theano/sparse/type.py

上级 a25bde02
...@@ -100,8 +100,8 @@ class SparseType(gof.Type): ...@@ -100,8 +100,8 @@ class SparseType(gof.Type):
a, b = b, a a, b = b, a
if _is_sparse(a) and isinstance(b, numpy.ndarray): if _is_sparse(a) and isinstance(b, numpy.ndarray):
if (numpy.may_share_memory(a.data, b) or if (numpy.may_share_memory(a.data, b) or
numpy.may_share_memory(a.indices, b) or numpy.may_share_memory(a.indices, b) or
numpy.may_share_memory(a.indptr, b)): numpy.may_share_memory(a.indptr, b)):
# currently we can't share memory with a.shape as it is a tuple # currently we can't share memory with a.shape as it is a tuple
return True return True
return False return False
...@@ -143,8 +143,8 @@ class SparseType(gof.Type): ...@@ -143,8 +143,8 @@ class SparseType(gof.Type):
# we definitely do not want to be doing this un-necessarily during # we definitely do not want to be doing this un-necessarily during
# a FAST_RUN computation.. # a FAST_RUN computation..
return scipy.sparse.issparse(a) \ return scipy.sparse.issparse(a) \
and scipy.sparse.issparse(b) \ and scipy.sparse.issparse(b) \
and abs(a - b).sum() == 0.0 and abs(a - b).sum() == 0.0
def is_valid_value(self, a): def is_valid_value(self, a):
return scipy.sparse.issparse(a) and (a.format == self.format) return scipy.sparse.issparse(a) and (a.format == self.format)
...@@ -162,10 +162,10 @@ class SparseType(gof.Type): ...@@ -162,10 +162,10 @@ class SparseType(gof.Type):
# Register SparseType's C code for ViewOp. # Register SparseType's C code for ViewOp.
theano.compile.register_view_op_c_code( theano.compile.register_view_op_c_code(
SparseType, SparseType,
""" """
Py_XDECREF(%(oname)s); Py_XDECREF(%(oname)s);
%(oname)s = %(iname)s; %(oname)s = %(iname)s;
Py_XINCREF(%(oname)s); Py_XINCREF(%(oname)s);
""", """,
1) 1)
...@@ -228,7 +228,6 @@ whitelist_flake8 = [ ...@@ -228,7 +228,6 @@ whitelist_flake8 = [
"misc/tests/test_pycuda_example.py", "misc/tests/test_pycuda_example.py",
"misc/hooks/reindent.py", "misc/hooks/reindent.py",
"misc/hooks/check_whitespace.py", "misc/hooks/check_whitespace.py",
"sparse/type.py",
"sparse/__init__.py", "sparse/__init__.py",
"sparse/tests/test_utils.py", "sparse/tests/test_utils.py",
"sparse/tests/test_opt.py", "sparse/tests/test_opt.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论