提交 a37aa58a authored 作者: Roy Xue's avatar Roy Xue

PEP8 reformat

上级 bad7ae3d
...@@ -24,8 +24,8 @@ def test_profiling(): ...@@ -24,8 +24,8 @@ def test_profiling():
x = [T.dvector("val%i" % i) for i in range(3)] x = [T.dvector("val%i" % i) for i in range(3)]
z = [] z = []
z += [T.outer(x[i], x[i+1]).sum(axis=1) for i in range(len(x)-1)] z += [T.outer(x[i], x[i + 1]).sum(axis=1) for i in range(len(x) - 1)]
z += [x[i] + x[i+1] for i in range(len(x)-1)] z += [x[i] + x[i + 1] for i in range(len(x) - 1)]
p = theano.ProfileStats(False) p = theano.ProfileStats(False)
...@@ -47,8 +47,10 @@ def test_profiling(): ...@@ -47,8 +47,10 @@ def test_profiling():
the_string = buf.getvalue() the_string = buf.getvalue()
lines1 = [l for l in the_string.split("\n") if "Max if linker" in l] lines1 = [l for l in the_string.split("\n") if "Max if linker" in l]
lines2 = [l for l in the_string.split("\n") if "Minimum peak" in l] lines2 = [l for l in the_string.split("\n") if "Minimum peak" in l]
assert "Max if linker=cvm(default): 8224KB (16408KB)" in the_string, (lines1, lines2) assert "Max if linker=cvm(default): 8224KB (16408KB)" in the_string, (
assert "Minimum peak from all valid apply node order is 8208KB" in the_string, (lines1, lines2) lines1, lines2)
assert "Minimum peak from all valid apply node order is 8208KB" in the_string, (
lines1, lines2)
finally: finally:
theano.config.profile = config1 theano.config.profile = config1
...@@ -64,10 +66,10 @@ def test_ifelse(): ...@@ -64,10 +66,10 @@ def test_ifelse():
theano.config.profile = True theano.config.profile = True
theano.config.profile_memory = True theano.config.profile_memory = True
a,b = T.scalars('a', 'b') a, b = T.scalars('a', 'b')
x,y = T.scalars('x', 'y') x, y = T.scalars('x', 'y')
z = ifelse(T.lt(a, b), x*2, y*2) z = ifelse(T.lt(a, b), x * 2, y * 2)
p = theano.ProfileStats(False) p = theano.ProfileStats(False)
...@@ -77,7 +79,7 @@ def test_ifelse(): ...@@ -77,7 +79,7 @@ def test_ifelse():
m = None m = None
f_ifelse = theano.function([a, b, x, y], z, profile=p, name="test_ifelse", f_ifelse = theano.function([a, b, x, y], z, profile=p, name="test_ifelse",
mode=m) mode=m)
val1 = 0. val1 = 0.
val2 = 1. val2 = 1.
...@@ -91,7 +93,6 @@ def test_ifelse(): ...@@ -91,7 +93,6 @@ def test_ifelse():
theano.config.profile_memory = config2 theano.config.profile_memory = config2
if __name__ == '__main__': if __name__ == '__main__':
test_profiling() test_profiling()
test_ifelse() test_ifelse()
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论