提交 365b05d1 authored 作者: lamblin's avatar lamblin

Merge pull request #1423 from nouiz/fixes

Fixes
...@@ -66,7 +66,10 @@ ...@@ -66,7 +66,10 @@
minimum value and 0.997527376843 as the maximum value. So it minimum value and 0.997527376843 as the maximum value. So it
never returns 0 or 1. never returns 0 or 1.
.. note:: Using directly the ultra_fast_sigmoid in the graph will
disable stabilization optimization associated with it. But
using the optimization to insert them won't disable the
stability optimization.
.. function:: hard_sigmoid(x) .. function:: hard_sigmoid(x)
...@@ -84,6 +87,10 @@ ...@@ -84,6 +87,10 @@
.. note:: The underlying code will return an exact 0 or 1 if an .. note:: The underlying code will return an exact 0 or 1 if an
element of x is too small or too big. element of x is too small or too big.
.. note:: Using directly the ultra_fast_sigmoid in the graph will
disable stabilization optimization associated with it. But
using the optimization to insert them won't disable the
stability optimization.
.. function:: softplus(x) .. function:: softplus(x)
......
...@@ -34,7 +34,8 @@ _atexit_print_file = sys.stderr ...@@ -34,7 +34,8 @@ _atexit_print_file = sys.stderr
AddConfigVar('profiling.time_thunks', AddConfigVar('profiling.time_thunks',
"""Time individual thunks when profiling""", """Time individual thunks when profiling""",
BoolParam(True)) BoolParam(True),
in_c_key=False)
AddConfigVar('profiling.n_apply', AddConfigVar('profiling.n_apply',
"Number of Apply instances to print by default", "Number of Apply instances to print by default",
......
...@@ -234,7 +234,8 @@ AddConfigVar('op.set_flops', ...@@ -234,7 +234,8 @@ AddConfigVar('op.set_flops',
AddConfigVar('gpuelemwise.sync', AddConfigVar('gpuelemwise.sync',
"when true, wait that the gpu fct finished and check it error code.", "when true, wait that the gpu fct finished and check it error code.",
BoolParam(True)) BoolParam(True),
in_c_key=False)
AddConfigVar('traceback.limit', AddConfigVar('traceback.limit',
"The number of stack to trace. -1 mean all.", "The number of stack to trace. -1 mean all.",
......
...@@ -80,7 +80,8 @@ AddConfigVar("compiledir_format", ...@@ -80,7 +80,8 @@ AddConfigVar("compiledir_format",
module subdirectory (relative to base_compiledir). module subdirectory (relative to base_compiledir).
Available keys: %s. Defaults to %r. Available keys: %s. Defaults to %r.
""" % (compiledir_format_keys, default_compiledir_format))), """ % (compiledir_format_keys, default_compiledir_format))),
StrParam(default_compiledir_format, allow_override=False)) StrParam(default_compiledir_format, allow_override=False),
in_c_key=False)
def default_compiledirname(): def default_compiledirname():
...@@ -160,7 +161,8 @@ AddConfigVar('base_compiledir', ...@@ -160,7 +161,8 @@ AddConfigVar('base_compiledir',
ConfigParam( ConfigParam(
default_base_compiledir, default_base_compiledir,
filter=filter_base_compiledir, filter=filter_base_compiledir,
allow_override=False)) allow_override=False),
in_c_key=False)
AddConfigVar('compiledir', AddConfigVar('compiledir',
"platform-dependent cache directory for compiled modules", "platform-dependent cache directory for compiled modules",
...@@ -169,7 +171,8 @@ AddConfigVar('compiledir', ...@@ -169,7 +171,8 @@ AddConfigVar('compiledir',
config.base_compiledir, config.base_compiledir,
default_compiledirname()), default_compiledirname()),
filter=filter_compiledir, filter=filter_compiledir,
allow_override=False)) allow_override=False),
in_c_key=False)
def cleanup(): def cleanup():
......
...@@ -41,13 +41,19 @@ def test_inter_process_cache(): ...@@ -41,13 +41,19 @@ def test_inter_process_cache():
""" """
x, y = theano.tensor.vectors('xy') x, y = theano.tensor.dvectors('xy')
f = theano.function([x, y], [MyOp()(x), MyOp()(y)]) f = theano.function([x, y], [MyOp()(x), MyOp()(y)])
f(numpy.arange(60), numpy.arange(60)) f(numpy.arange(60), numpy.arange(60))
if theano.config.mode == 'FAST_COMPILE':
assert MyOp.nb_called == 0
else:
assert MyOp.nb_called == 1 assert MyOp.nb_called == 1
# What if we compile a new function with new variables? # What if we compile a new function with new variables?
x, y = theano.tensor.vectors('xy') x, y = theano.tensor.dvectors('xy')
f = theano.function([x, y], [MyOp()(x), MyOp()(y)]) f = theano.function([x, y], [MyOp()(x), MyOp()(y)])
f(numpy.arange(60), numpy.arange(60)) f(numpy.arange(60), numpy.arange(60))
if theano.config.mode == 'FAST_COMPILE':
assert MyOp.nb_called == 0
else:
assert MyOp.nb_called == 1 assert MyOp.nb_called == 1
...@@ -20,14 +20,16 @@ logger = logging.getLogger(__name__) ...@@ -20,14 +20,16 @@ logger = logging.getLogger(__name__)
AddConfigVar('profile', AddConfigVar('profile',
"If VM should collect profile information", "If VM should collect profile information",
BoolParam(False)) BoolParam(False),
in_c_key=False)
AddConfigVar('profile_optimizer', AddConfigVar('profile_optimizer',
"If VM should collect optimizer profile information", "If VM should collect optimizer profile information",
BoolParam(False)) BoolParam(False),
in_c_key=False)
AddConfigVar('profile_memory', AddConfigVar('profile_memory',
"If VM should collect memory profile information and print it", "If VM should collect memory profile information and print it",
BoolParam(False)) BoolParam(False),
in_c_key=False)
def filter_vm_lazy(val): def filter_vm_lazy(val):
if val == 'False' or val is False: if val == 'False' or val is False:
...@@ -45,7 +47,8 @@ AddConfigVar('vm.lazy', ...@@ -45,7 +47,8 @@ AddConfigVar('vm.lazy',
" auto detect if lazy evaluation is needed and use the apropriate" " auto detect if lazy evaluation is needed and use the apropriate"
" version. If lazy is True/False, force the version used between" " version. If lazy is True/False, force the version used between"
" Loop/LoopGC and Stack.", " Loop/LoopGC and Stack.",
ConfigParam('None', filter_vm_lazy)) ConfigParam('None', filter_vm_lazy),
in_c_key=False)
raise_with_op = link.raise_with_op raise_with_op = link.raise_with_op
......
...@@ -27,7 +27,8 @@ AddConfigVar('cuda.root', ...@@ -27,7 +27,8 @@ AddConfigVar('cuda.root',
linker directives. Default: environment variable "CUDA_ROOT" linker directives. Default: environment variable "CUDA_ROOT"
or else "AUTO". or else "AUTO".
""", """,
StrParam(os.getenv('CUDA_ROOT', "AUTO"))) StrParam(os.getenv('CUDA_ROOT', "AUTO")),
in_c_key=False)
AddConfigVar('pycuda.init', AddConfigVar('pycuda.init',
"""If True, always initialize PyCUDA when Theano want to """If True, always initialize PyCUDA when Theano want to
...@@ -37,7 +38,8 @@ AddConfigVar('pycuda.init', ...@@ -37,7 +38,8 @@ AddConfigVar('pycuda.init',
manually by importing theano.misc.pycuda_init before theano manually by importing theano.misc.pycuda_init before theano
initialize the GPU device. initialize the GPU device.
""", """,
BoolParam(False)) BoolParam(False),
in_c_key=False)
if config.cuda.root == "AUTO": if config.cuda.root == "AUTO":
# set nvcc_path correctly and get the version # set nvcc_path correctly and get the version
......
...@@ -27,7 +27,8 @@ from theano.configparser import (config, AddConfigVar, StrParam, ...@@ -27,7 +27,8 @@ from theano.configparser import (config, AddConfigVar, StrParam,
AddConfigVar('nvcc.compiler_bindir', AddConfigVar('nvcc.compiler_bindir',
"If defined, nvcc compiler driver will seek g++ and gcc" "If defined, nvcc compiler driver will seek g++ and gcc"
" in this directory", " in this directory",
StrParam("")) StrParam(""),
in_c_key=False)
AddConfigVar('cuda.nvccflags', AddConfigVar('cuda.nvccflags',
"DEPRECATED, use nvcc.flags instead", "DEPRECATED, use nvcc.flags instead",
...@@ -52,12 +53,20 @@ def filter_nvcc_flags(s): ...@@ -52,12 +53,20 @@ def filter_nvcc_flags(s):
return ' '.join(flags) return ' '.join(flags)
AddConfigVar('nvcc.flags', AddConfigVar('nvcc.flags',
"Extra compiler flags for nvcc", "Extra compiler flags for nvcc",
ConfigParam(config.cuda.nvccflags, filter_nvcc_flags)) ConfigParam(config.cuda.nvccflags, filter_nvcc_flags),
# Not needed in c key as it is already added.
# We remove it as we don't make the md5 of config to change
# if theano.sandbox.cuda is loaded or not.
in_c_key=False)
AddConfigVar('nvcc.fastmath', AddConfigVar('nvcc.fastmath',
"", "",
BoolParam(False)) BoolParam(False),
# Not needed in c key as it is already added.
# We remove it as we don't make the md5 of config to change
# if theano.sandbox.cuda is loaded or not.
in_c_key=False)
nvcc_path = 'nvcc' nvcc_path = 'nvcc'
nvcc_version = None nvcc_version = None
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论