提交 3c02813f authored 作者: Frederic's avatar Frederic

pep8

上级 d82eb54a
...@@ -6,26 +6,27 @@ import theano ...@@ -6,26 +6,27 @@ import theano
import theano.tensor as T import theano.tensor as T
import StringIO import StringIO
def test_profiling(): def test_profiling():
old1 = theano.config.profile old1 = theano.config.profile
old2 = theano.config.profile_memory old2 = theano.config.profile_memory
theano.config.profile = True theano.config.profile = True
theano.config.profile_memory = True theano.config.profile_memory = True
x = T.dvector("x") x = T.dvector("x")
y = T.dvector("y") y = T.dvector("y")
z = x + y z = x + y
f = theano.function([x, y], z, profile=True, name="test_profiling") f = theano.function([x, y], z, profile=True, name="test_profiling")
output = f([1, 2, 3, 4],[1, 1, 1, 1]) output = f([1, 2, 3, 4], [1, 1, 1, 1])
buf = StringIO.StringIO() buf = StringIO.StringIO()
f.profile.summary(buf) f.profile.summary(buf)
theano.config.profile = old1 theano.config.profile = old1
theano.config.profile_memory = old2 theano.config.profile_memory = old2
if __name__ == '__main__': if __name__ == '__main__':
test_profiling() test_profiling()
\ No newline at end of file
...@@ -305,7 +305,7 @@ class Stack(VM): ...@@ -305,7 +305,7 @@ class Stack(VM):
t0 = time.time() t0 = time.time()
rval = self.thunks[idx]() rval = self.thunks[idx]()
self.node_executed_order.append(node) self.node_executed_order.append(node)
# Some thunks on some computers run faster than the granularity # Some thunks on some computers run faster than the granularity
# of the time.time clock. # of the time.time clock.
# Profile output looks buggy if a node has run but takes 0 time. # Profile output looks buggy if a node has run but takes 0 time.
...@@ -313,11 +313,11 @@ class Stack(VM): ...@@ -313,11 +313,11 @@ class Stack(VM):
dt = max(time.time() - t0, 1e-10) dt = max(time.time() - t0, 1e-10)
if self.callback is not None: if self.callback is not None:
self.callback( self.callback(
node=node, node=node,
thunk=self.thunks[idx], thunk=self.thunks[idx],
storage_map=self.storage_map, storage_map=self.storage_map,
compute_map=self.compute_map, compute_map=self.compute_map,
) )
return rval, dt return rval, dt
def __call__(self): def __call__(self):
...@@ -327,7 +327,7 @@ class Stack(VM): ...@@ -327,7 +327,7 @@ class Stack(VM):
dependencies = self.dependencies dependencies = self.dependencies
self.node_executed_order = [] self.node_executed_order = []
self.node_cleared_order = [] self.node_cleared_order = []
for k in self.storage_map: for k in self.storage_map:
compute_map[k][0] = (k.owner is None) compute_map[k][0] = (k.owner is None)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论