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

allow to pass many value to the new theano flags separated by :

上级 4f375851
......@@ -157,4 +157,26 @@ Config Attributes
Extra parameters to pass to gcc when compiling. Extra include paths,
library paths, configuration options, etc.
.. attribute:: optimizer_excluding
Default: ""
A list of optimizer tags that we don't want included in the default Mode.
If multiple tags, separate them by ':'.
Ex: to remove the elemwise inplace optimizer(slow for big graph)
use the flags: optimizer_excluding:inplace_opt
inplace_opt is the name of that optimization.
.. attribute:: optimizer_including
Default: ""
A list of optimizer tags that we want included in the default Mode.
If multiple tags, separate them by ':'.
.. attribute:: optimizer_requiring
Default: ""
A list of optimizer tags that we require for optimizer in the default Mode.
If multiple tags, separate them by ':'.
......@@ -9,13 +9,13 @@ from theano.configparser import config, AddConfigVar, StrParam
_logger = logging.getLogger('theano.compile.mode')
AddConfigVar('optimizer_excluding',
"When using the default mode, we will remove optimizer with that tag",
"When using the default mode, we will remove optimizer with that tag. Separate many tags with ':'.",
StrParam(""))
AddConfigVar('optimizer_including',
"When using the default mode, we will add optimizer with that tag",
"When using the default mode, we will add optimizer with that tag. Separate many tags with ':'.",
StrParam(""))
AddConfigVar('optimizer_requiring',
"When using the default mode, we will require optimizer with that tag",
"When using the default mode, we will require optimizer with that tag. Separate many tags with ':'.",
StrParam(""))
def check_equal(x, y):
......@@ -278,11 +278,7 @@ def get_mode(orig_string):
from profilemode import ProfileMode,prof_mode_instance_to_print
from debugmode import DebugMode
instanciated_default_mode = eval(string+'(linker=config.linker, optimizer=config.optimizer)')
#must tell python to print the summary at the end.
if string == 'ProfileMode':
prof_mode_instance_to_print.append(instanciated_default_mode)
ret = instanciated_default_mode
ret = eval(string+'(linker=config.linker, optimizer=config.optimizer)')
elif not predefined_modes.has_key(string):
raise Exception("No predefined mode exist for string: %s"%string)
......@@ -290,12 +286,17 @@ def get_mode(orig_string):
if orig_string is None:
if theano.config.optimizer_excluding:
ret = ret.excluding(theano.config.optimizer_excluding)
ret = ret.excluding(*theano.config.optimizer_excluding.split(':'))
if theano.config.optimizer_including:
ret = ret.including(theano.config.optimizer_including)
ret = ret.including(*theano.config.optimizer_including.split(':'))
if theano.config.optimizer_requiring:
ret = ret.requiring(theano.config.optimizer_requiring)
ret = ret.requiring(*theano.config.optimizer_requiring.split(':'))
instanciated_default_mode = ret
#must tell python to print the summary at the end.
if string == 'ProfileMode':
prof_mode_instance_to_print.append(ret)
return ret
def get_default_mode():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论