提交 5b430278 authored 作者: Li's avatar Li 提交者: Frederic

minor changes

上级 fa474bd0
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
========================== ==========================
Frequently Asked Questions Frequently Asked Questions
========================== ==========================
3B
TypeError: object of type 'TensorVariable' has no len() TypeError: object of type 'TensorVariable' has no len()
------------------------------------------------------- -------------------------------------------------------
......
...@@ -1239,24 +1239,25 @@ class FunctionMaker(object): ...@@ -1239,24 +1239,25 @@ class FunctionMaker(object):
add_stack_trace_on_call_orig = gof.Op.add_stack_trace_on_call add_stack_trace_on_call_orig = gof.Op.add_stack_trace_on_call
if need_opt: if need_opt:
# optimize the fgraph try:
theano.config.compute_test_value = theano.config.compute_test_value_opt # optimize the fgraph
gof.Op.add_stack_trace_on_call = False theano.config.compute_test_value = theano.config.compute_test_value_opt
start_optimizer = time.time() gof.Op.add_stack_trace_on_call = False
optimizer_profile = optimizer(fgraph) start_optimizer = time.time()
end_optimizer = time.time() optimizer_profile = optimizer(fgraph)
opt_time = end_optimizer - start_optimizer end_optimizer = time.time()
if profile: opt_time = end_optimizer - start_optimizer
profile.optimizer_time += opt_time if profile:
if theano.config.profile_optimizer: profile.optimizer_time += opt_time
profile.optimizer_profile = (optimizer, optimizer_profile) if theano.config.profile_optimizer:
_logger.debug('Optimizing took %f seconds', opt_time) profile.optimizer_profile = (optimizer, optimizer_profile)
_logger.debug('Optimizing took %f seconds', opt_time)
#Add deep copy to respect the memory interface
insert_deepcopy(fgraph, inputs, outputs + additional_outputs) #Add deep copy to respect the memory interface
# fgraph is already optimized insert_deepcopy(fgraph, inputs, outputs + additional_outputs)
theano.config.compute_test_value = compute_test_value_orig finally:
gof.Op.add_stack_trace_on_call = add_stack_trace_on_call_orig theano.config.compute_test_value = compute_test_value_orig
gof.Op.add_stack_trace_on_call = add_stack_trace_on_call_orig
# initialize the linker # initialize the linker
if not hasattr(linker, 'accept'): if not hasattr(linker, 'accept'):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论