提交 cbb02686 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

PEP8 fixes

上级 8a855c90
......@@ -181,8 +181,8 @@ def test_speed_lazy():
run_memory_usage_tests = False
if run_memory_usage_tests:
# these are not normal unit tests, do not run them as part of standard
# suite. I ran them while looking at top, and stopped when memory usage was
# stable.
# suite. I ran them while looking at top, and stopped when memory usage
# was stable.
def test_leak2():
import theano.sandbox.cuda as cuda
for i in xrange(1000000):
......@@ -199,13 +199,13 @@ if run_memory_usage_tests:
def test_no_leak_many_graphs():
# Verify no memory leaks when creating and deleting a lot of functions
# This isn't really a unit test, you have to run it and look at top to see
# if there's a leak
# This isn't really a unit test, you have to run it and look at top to
# see if there's a leak
for i in xrange(10000):
x = tensor.vector()
z = x
for d in range(10):
z = tensor.sin(-z+ 1)
z = tensor.sin(-z + 1)
f = function([x], z, mode=Mode(optimizer=None, linker='cvm'))
if not i % 100:
......@@ -222,13 +222,13 @@ if run_memory_usage_tests:
def test_no_leak_many_call_lazy():
# Verify no memory leaks when calling a function a lot of times
# This isn't really a unit test, you have to run it and look at top to see
# if there's a leak
# This isn't really a unit test, you have to run it and look at top to
# see if there's a leak
def build_graph(x, depth=5):
z = x
for d in range(depth):
z = ifelse(z> 0, -z, z)
z = ifelse(z > 0, -z, z)
return z
def time_linker(name, linker):
......@@ -250,24 +250,25 @@ if run_memory_usage_tests:
print pre.ru_idrss, post.ru_idrss
print pre.ru_maxrss, post.ru_maxrss
time_linker('vmLinker_C', lambda : vm.VM_Linker(allow_gc=False, use_cloop=True))
time_linker('vmLinker_C',
lambda: vm.VM_Linker(allow_gc=False, use_cloop=True))
def test_no_leak_many_call_nonlazy():
# Verify no memory leaks when calling a function a lot of times
# This isn't really a unit test, you have to run it and look at top to see
# if there's a leak
# This isn't really a unit test, you have to run it and look at top to
# see if there's a leak.
def build_graph(x, depth=5):
z = x
for d in range(depth):
z = tensor.sin(-z+1)
z = tensor.sin(-z + 1)
return z
def time_linker(name, linker):
steps_a = 10
x = tensor.vector()
a = build_graph(x,steps_a)
a = build_graph(x, steps_a)
f_a = function([x], a,
mode=Mode(optimizer=None,
......@@ -276,7 +277,8 @@ if run_memory_usage_tests:
for i in xrange(500000):
f_a([2.0])
time_linker('vmLinker_C', lambda : vm.VM_Linker(allow_gc=False, use_cloop=True))
time_linker('vmLinker_C',
lambda: vm.VM_Linker(allow_gc=False, use_cloop=True))
class RunOnce(theano.Op):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论