提交 d0c93bbe authored 作者: Hengjean's avatar Hengjean 提交者: Frederic

Added flag, defaulted to False.

上级 99157a6d
...@@ -1104,6 +1104,7 @@ class FunctionMaker(object): ...@@ -1104,6 +1104,7 @@ class FunctionMaker(object):
graph_db = {} graph_db = {}
print 'loaded graph_db from %s, size=%d' % (graph_db_file, len(graph_db)) print 'loaded graph_db from %s, size=%d' % (graph_db_file, len(graph_db))
if theano.config.cache_optimizations:
need_optimize = True need_optimize = True
# the sole purpose of this loop is to set 'need_optimize' # the sole purpose of this loop is to set 'need_optimize'
for i, graph_old in enumerate(graph_db.keys()): for i, graph_old in enumerate(graph_db.keys()):
...@@ -1201,7 +1202,11 @@ class FunctionMaker(object): ...@@ -1201,7 +1202,11 @@ class FunctionMaker(object):
fgraph = self.fgraph fgraph = self.fgraph
# release stuff # release stuff
release_lock() release_lock()
else:
start_optimizer = time.time()
optimizer_profile = optimizer(fgraph)
end_optimizer = time.time()
opt_time = end_optimizer - start_optimizer
print 'opt took %s' % opt_time print 'opt took %s' % opt_time
if profile: if profile:
profile.optimizer_time += opt_time profile.optimizer_time += opt_time
......
...@@ -538,3 +538,10 @@ AddConfigVar('check_input', ...@@ -538,3 +538,10 @@ AddConfigVar('check_input',
"(particularly for scalars) and reduce the number of generated C " "(particularly for scalars) and reduce the number of generated C "
"files.", "files.",
BoolParam(True)) BoolParam(True))
AddConfigVar('cache_optimizations',
"Specify if the optimization cache should be used. This cache will"
"any optimized graph and its optimization. Actually slow downs a lot"
"the first optimization, and could possibly still contains some bugs."
"Use at your own risks.",
BoolParam(False))
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论