提交 4fab8bf4 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Small typo fixes + unsafe string comparison fix

上级 05f36e3e
...@@ -288,12 +288,12 @@ can be achieved as follows: ...@@ -288,12 +288,12 @@ can be achieved as follows:
To help understand what is happening in your graph, you can To help understand what is happening in your graph, you can
disable the ``local_elemwise_fusion`` and all ``inplace`` disable the ``local_elemwise_fusion`` and all ``inplace``
optimizations. The first is a speed optimization that merge elemwise optimizations. The first is a speed optimization that merges elemwise
operations together. This make it harder to know which particular operations together. This makes it harder to know which particular
elemwise cause the problem. The second optimization make some ops elemwise causes the problem. The second optimization makes some ops'
output overwrite its input. So, if an op create a bad output, you outputs overwrite their inputs. So, if an op creates a bad output, you
won't be able see the input that was overwriten in the ``post_fun`` will not be able to see the input that was overwriten in the ``post_func``
function. To disable those optimization (with a Theano version after function. To disable those optimizations (with a Theano version after
0.6rc3), define the MonitorMode like this: 0.6rc3), define the MonitorMode like this:
.. code-block:: python .. code-block:: python
...@@ -311,7 +311,7 @@ function. To disable those optimization (with a Theano version after ...@@ -311,7 +311,7 @@ function. To disable those optimization (with a Theano version after
mode with MonitorMode, as you need to define what you monitor. mode with MonitorMode, as you need to define what you monitor.
To be sure all inputs of the node are available during the call to To be sure all inputs of the node are available during the call to
``post_func``, you also must disable the garbage collector. Otherwise, ``post_func``, you must also disable the garbage collector. Otherwise,
the execution of the node can garbage collect its inputs that aren't the execution of the node can garbage collect its inputs that aren't
needed anymore by the Theano function. This can be done with the Theano needed anymore by the Theano function. This can be done with the Theano
flag: flag:
......
...@@ -37,14 +37,14 @@ class MonitorMode(Mode): ...@@ -37,14 +37,14 @@ class MonitorMode(Mode):
:param optimizer: The optimizer to use. One may use for instance :param optimizer: The optimizer to use. One may use for instance
'fast_compile' to skip optimizations. 'fast_compile' to skip optimizations.
:param linker: DO NOT USE. This mode use its own linker. :param linker: DO NOT USE. This mode uses its own linker.
The parameter is needed to allow selecting optimizers to use. The parameter is needed to allow selecting optimizers to use.
""" """
self.pre_func = pre_func self.pre_func = pre_func
self.post_func = post_func self.post_func = post_func
wrap_linker = theano.gof.WrapLinkerMany([theano.gof.OpWiseCLinker()], wrap_linker = theano.gof.WrapLinkerMany([theano.gof.OpWiseCLinker()],
[self.eval]) [self.eval])
if optimizer is 'default': if optimizer == 'default':
optimizer = theano.config.optimizer optimizer = theano.config.optimizer
if (linker is not None and if (linker is not None and
not isinstance(linker.mode, MonitorMode)): not isinstance(linker.mode, MonitorMode)):
......
...@@ -442,7 +442,8 @@ def pfunc(params, outputs=None, mode=None, updates=None, givens=None, ...@@ -442,7 +442,8 @@ def pfunc(params, outputs=None, mode=None, updates=None, givens=None,
if len(updates) > 0 and any(isinstance(v, Variable) if len(updates) > 0 and any(isinstance(v, Variable)
for v in iter_over_pairs(updates)): for v in iter_over_pairs(updates)):
raise ValueError( raise ValueError(
"The updates parameter must an OrderedDict/dict or a list of list/tuple with 2 elements") "The updates parameter must be an OrderedDict/dict or a list of "
"lists/tuples with 2 elements")
# transform params into theano.compile.In objects. # transform params into theano.compile.In objects.
inputs = [_pfunc_param_to_in(p, allow_downcast=allow_input_downcast) inputs = [_pfunc_param_to_in(p, allow_downcast=allow_input_downcast)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论