提交 4922359b authored 作者: Frederic's avatar Frederic

Accept profile=False and when we profile, preload the c module cache to don't…

Accept profile=False and when we profile, preload the c module cache to don't have it include in optimization time.
上级 4a8f5164
...@@ -994,11 +994,16 @@ class FunctionMaker(object): ...@@ -994,11 +994,16 @@ class FunctionMaker(object):
# we allow ProfileMode to provide a ProfileStats object # we allow ProfileMode to provide a ProfileStats object
# using this somewhat awkward mechanism. # using this somewhat awkward mechanism.
mode_profile = getattr(mode, 'profile', None) mode_profile = getattr(mode, 'profile', None)
if (profile is not None) and (mode_profile is not None): if (profile is not None and
profile is not False and
mode_profile is not None):
raise TypeError( raise TypeError(
'profile passed via both "mode" and "profile" arguments') 'profile passed via both "mode" and "profile" arguments')
self.profile = profile = profile or mode_profile self.profile = profile = profile or mode_profile
if profile:
# We preload the cache here to don't have its timming
# included in optimization that compile function.
theano.gof.cc.get_module_cache()
# Handle the case where inputs and/or outputs is a single Variable (not in a list) # Handle the case where inputs and/or outputs is a single Variable (not in a list)
self.orig_outputs = outputs self.orig_outputs = outputs
unpack_single = False unpack_single = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论