提交 3b7aa75e authored 作者: Benjamin Scellier's avatar Benjamin Scellier

fix pep8 errors

上级 74661b8b
......@@ -287,7 +287,7 @@ class BadOptimization(DebugModeError):
# nv == ov == 0
reldiff = (abs_diff /
np.maximum(np.absolute(nv) + np.absolute(ov),
1e-8))
1e-8))
print(" Max Rel Diff: ", np.max(reldiff), file=ssio)
print(" Mean Rel Diff: ", np.mean(reldiff), file=ssio)
print(" Median Rel Diff: ", np.median(reldiff), file=ssio)
......
......@@ -830,8 +830,8 @@ class Function(object):
[self.input_storage[k].storage[0] for k
in args_share_memory[j]])
if np.any([(var.type is i_var.type and
var.type.may_share_memory(val, i_val))
for (var, val) in group_j]):
var.type.may_share_memory(val, i_val))
for (var, val) in group_j]):
is_aliased = True
args_share_memory[j].append(i)
......
......@@ -836,7 +836,7 @@ class SpecifyShape(gof.Op):
out, = out_
assert x.ndim == shape.size
assert np.all(x.shape == shape), ("got shape", x.shape,
"expected", shape)
"expected", shape)
out[0] = x
def infer_shape(self, node, shapes):
......
......@@ -108,7 +108,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
f = f - T.grad(T.sum(f), s)
fn = function([x, y, z], f)
assert np.allclose(15.0 + s.get_value(),
fn(xv, yv, zv))
fn(xv, yv, zv))
def test_connection_pattern(self):
# Basic case
......
......@@ -579,7 +579,7 @@ class Test_check_isfinite(unittest.TestCase):
'DEBUG_MODE'].check_isfinite = False
# insert several Inf
f(np.asarray(np.asarray([1.0, 1.0, 1.0]) / 0,
dtype=config.floatX))
dtype=config.floatX))
def test_check_isfinite_disabled(self):
x = theano.tensor.dvector()
......
......@@ -701,7 +701,7 @@ class Test_aliasing_rules(unittest.TestCase):
# rule #2 reading back from theano-managed memory
assert not np.may_share_memory(A.get_value(borrow=False),
data_of(A))
data_of(A))
def test_sparse_input_aliasing_affecting_inplace_operations(self):
##
......@@ -773,20 +773,20 @@ class Test_aliasing_rules(unittest.TestCase):
# Compute bogus values
v = np.asarray([1, 2, 3, 4, 5], dtype='float64')
m = np.asarray([[1, 0, 0, 0, 0],
[0, 1, 0, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 0, 1]], dtype='float64')
[0, 1, 0, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 0, 1]], dtype='float64')
bogus_vals = f(v, v, m, m)
# Since we used inplace operation v and m may be corrupted
# so we need to recreate them
v = np.asarray([1, 2, 3, 4, 5], dtype='float64')
m = np.asarray([[1, 0, 0, 0, 0],
[0, 1, 0, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 0, 1]], dtype='float64')
[0, 1, 0, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 0, 1]], dtype='float64')
m_copy = m.copy()
v_copy = v.copy()
vals = f(v, v_copy, m, m_copy)
......@@ -824,14 +824,14 @@ class Test_aliasing_rules(unittest.TestCase):
# Compute bogus values
v = np.asarray([1, 2, 3, 4, 5], dtype='float64')
m = np.asarray([[1, 0],
[0, 1]], dtype='float64')
[0, 1]], dtype='float64')
bogus_vals = f(v[:2], v[1:3], v[2:4], m, m, m)
# Since we used inplace operation v and m may be corrupted
# so we need to recreate them
v = np.asarray([1, 2, 3, 4, 5], dtype='float64')
m = np.asarray([[1, 0],
[0, 1]], dtype='float64')
[0, 1]], dtype='float64')
m_copy1 = m.copy()
v_copy1 = v.copy()
m_copy2 = m.copy()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论