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

pep8

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