提交 5aebc410 authored 作者: Iban Harlouchet's avatar Iban Harlouchet

flake 8 for tensor/var.py

上级 c7340d33
import copy import copy
import pdb
import sys
import traceback as tb import traceback as tb
import warnings import warnings
...@@ -41,9 +39,9 @@ class _tensor_py_operators: ...@@ -41,9 +39,9 @@ class _tensor_py_operators:
# CASTS # CASTS
# REMOVED THESE BECAUSE PYTHON appears to require __int__ to return # REMOVED THESE BECAUSE PYTHON appears to require __int__ to return
# an int. -JB 20081112 # an int. -JB 20081112
#def __int__(self): return convert_to_int32(self) # def __int__(self): return convert_to_int32(self)
#def __float__(self): return convert_to_float64(self) # def __float__(self): return convert_to_float64(self)
#def __complex__(self): return convert_to_complex128(self) # def __complex__(self): return convert_to_complex128(self)
# COMPARISONS # COMPARISONS
_is_nonzero = True _is_nonzero = True
...@@ -215,7 +213,7 @@ class _tensor_py_operators: ...@@ -215,7 +213,7 @@ class _tensor_py_operators:
# DO NOT USE THESE BECAUSE INPLACE OPS SHOULD BE INSERTED # DO NOT USE THESE BECAUSE INPLACE OPS SHOULD BE INSERTED
# BY OPTIMIZATIONS ONLY # BY OPTIMIZATIONS ONLY
## ARITHMETIC - INPLACE # ARITHMETIC - INPLACE
# def __iadd__(self, other): # def __iadd__(self, other):
# return _add_inplace(self, other) # return _add_inplace(self, other)
# def __isub__(self, other): # def __isub__(self, other):
...@@ -642,7 +640,8 @@ class TensorVariable(_tensor_py_operators, Variable): ...@@ -642,7 +640,8 @@ class TensorVariable(_tensor_py_operators, Variable):
elif config.warn_float64 == "raise": elif config.warn_float64 == "raise":
raise Exception(msg) raise Exception(msg)
elif config.warn_float64 == 'pdb': elif config.warn_float64 == 'pdb':
import pdb; pdb.set_trace() import pdb
pdb.set_trace()
TensorType.Variable = TensorVariable TensorType.Variable = TensorVariable
...@@ -744,8 +743,8 @@ class TensorConstant(_tensor_py_operators, Constant): ...@@ -744,8 +743,8 @@ class TensorConstant(_tensor_py_operators, Constant):
def __init__(self, type, data, name=None): def __init__(self, type, data, name=None):
Constant.__init__(self, type, data, name) Constant.__init__(self, type, data, name)
if (isinstance(data, numpy.ndarray) and if (isinstance(data, numpy.ndarray) and
data.ndim > 0 and data.ndim > 0 and
len(numpy.unique(data)) == 1): len(numpy.unique(data)) == 1):
self.tag.unique_value = numpy.unique(data)[0] self.tag.unique_value = numpy.unique(data)[0]
else: else:
self.tag.unique_value = None self.tag.unique_value = None
......
...@@ -57,7 +57,6 @@ whitelist_flake8 = [ ...@@ -57,7 +57,6 @@ whitelist_flake8 = [
"typed_list/tests/test_type.py", "typed_list/tests/test_type.py",
"typed_list/tests/test_opt.py", "typed_list/tests/test_opt.py",
"typed_list/tests/test_basic.py", "typed_list/tests/test_basic.py",
"tensor/var.py",
"tensor/sharedvar.py", "tensor/sharedvar.py",
"tensor/inplace.py", "tensor/inplace.py",
"tensor/slinalg.py", "tensor/slinalg.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论