提交 eed64db9 authored 作者: Frederic Bastien's avatar Frederic Bastien

refactored the import of run_cthunk to do it less often.

上级 061857c4
...@@ -73,6 +73,12 @@ class Profile_Maker(FunctionMaker): ...@@ -73,6 +73,12 @@ class Profile_Maker(FunctionMaker):
del self.mode.outputs_size del self.mode.outputs_size
ret.fn = new_fn ret.fn = new_fn
global run_cthunk
if run_cthunk is None:
# Lazy import to avoid compilation when importing theano.
from theano.gof.cutils import run_cthunk
return ret return ret
class ProfileMode(Mode): class ProfileMode(Mode):
...@@ -114,9 +120,6 @@ class ProfileMode(Mode): ...@@ -114,9 +120,6 @@ class ProfileMode(Mode):
""" """
global run_cthunk global run_cthunk
if hasattr(th, 'cthunk'): if hasattr(th, 'cthunk'):
if run_cthunk is None:
# Lazy import to avoid compilation when importing theano.
from theano.gof.cutils import run_cthunk
t0 = time.time() t0 = time.time()
failure = run_cthunk(th.cthunk) failure = run_cthunk(th.cthunk)
dt = time.time() - t0 dt = time.time() - t0
...@@ -137,9 +140,6 @@ class ProfileMode(Mode): ...@@ -137,9 +140,6 @@ class ProfileMode(Mode):
""" """
global run_cthunk global run_cthunk
if hasattr(th, 'cthunk'): if hasattr(th, 'cthunk'):
if run_cthunk is None:
# Lazy import to avoid compilation when importing theano.
from theano.gof.cutils import run_cthunk
t0 = time.time() t0 = time.time()
failure = run_cthunk(th.cthunk) failure = run_cthunk(th.cthunk)
dt = time.time() - t0 dt = time.time() - t0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论