提交 69f38702 authored 作者: Michael Osthege's avatar Michael Osthege

Remove numpy-related config settings

They just wrapped around numpy.seterr, which users should call directly instead. This also changes the default behaviour from setting numpy.seterr(all="ignore") to leaving all at its numpy default.
上级 55c88832
......@@ -920,80 +920,6 @@ import theano and print the config variable, as in:
Controls whether NanGuardMode generates an error when it sees a
big value (>1e10).
.. attribute:: numpy
This section contains different attributes for configuring NumPy's
behaviour, described by `numpy.seterr
<http://docs.scipy.org/doc/numpy/reference/generated/numpy.seterr.html>`__.
.. attribute:: config.numpy__seterr_all
String Value: ``'ignore'``, ``'warn'``, ``'raise'``, ``'call'``,
``'print'``, ``'log'``, ``'None'``
Default: ``'ignore'``
Set the default behaviour described by `numpy.seterr
<http://docs.scipy.org/doc/numpy/reference/generated/numpy.seterr.html>`__.
``'None'`` means that numpy's default behaviour will not be changed (unless
one of the other ``config.numpy__seterr_*`` overrides it), but this behaviour
can change between numpy releases.
This flag sets the default behaviour for all kinds of floating-point
errors, and it can be overridden for specific errors by setting one
(or more) of the flags below.
This flag's value cannot be modified during the program execution.
.. attribute:: config.numpy__seterr_divide
String Value: ``'None'``, ``'ignore'``, ``'warn'``, ``'raise'``,
``'call'``, ``'print'``, ``'log'``
Default: ``'None'``
Sets numpy's behavior for division by zero. ``'None'`` means using the
default, defined by config.numpy__seterr_all.
This flag's value cannot be modified during the program execution.
.. attribute:: config.numpy__seterr_over
String Value: ``'None'``, ``'ignore'``, ``'warn'``, ``'raise'``,
``'call'``, ``'print'``, ``'log'``
Default: ``'None'``
Sets numpy's behavior for floating-point overflow. ``'None'`` means
using the default, defined by config.numpy__seterr_all.
This flag's value cannot be modified during the program execution.
.. attribute:: config.numpy__seterr_under
String Value: ``'None'``, ``'ignore'``, ``'warn'``, ``'raise'``,
``'call'``, ``'print'``, ``'log'``
Default: ``'None'``
Sets numpy's behavior for floating-point underflow. ``'None'`` means
using the default, defined by config.numpy__seterr_all.
This flag's value cannot be modified during the program execution.
.. attribute:: config.numpy__seterr_invalid
String Value: ``'None'``, ``'ignore'``, ``'warn'``, ``'raise'``,
``'call'``, ``'print'``, ``'log'``
Default: ``'None'``
Sets numpy's behavior for invalid floating-point operation. ``'None'``
means using the default, defined by :attr:`config.numpy__seterr_all`.
This flag's value cannot be modified during the program execution.
.. attribute:: compute_test_value
String Value: ``'off'``, ``'ignore'``, ``'warn'``, ``'raise'``.
......
......@@ -123,33 +123,6 @@ if (
):
import theano.gpuarray
# Use config.numpy to call numpy.seterr
import numpy as np
if config.numpy__seterr_all == "None":
_all = None
else:
_all = config.numpy__seterr_all
if config.numpy__seterr_divide == "None":
_divide = None
else:
_divide = config.numpy__seterr_divide
if config.numpy__seterr_over == "None":
_over = None
else:
_over = config.numpy__seterr_over
if config.numpy__seterr_under == "None":
_under = None
else:
_under = config.numpy__seterr_under
if config.numpy__seterr_invalid == "None":
_invalid = None
else:
_invalid = config.numpy__seterr_invalid
np.seterr(all=_all, divide=_divide, over=_over, under=_under, invalid=_invalid)
del _all, _divide, _over, _under, _invalid
def get_scalar_constant_value(v):
"""Return the constant scalar (i.e. 0-D) value underlying variable `v`.
......
......@@ -935,74 +935,6 @@ def add_experimental_configvars():
def add_error_and_warning_configvars():
config.add(
"numpy__seterr_all",
(
"Sets numpy's behaviour for floating-point errors, ",
"see numpy.seterr. "
"'None' means not to change numpy's default, which can be "
"different for different numpy releases. "
"This flag sets the default behaviour for all kinds of floating-"
"point errors, its effect can be overriden for specific errors "
"by the following flags: seterr_divide, seterr_over, "
"seterr_under and seterr_invalid.",
),
EnumStr(
"ignore", ["warn", "raise", "call", "print", "log", "None"], mutable=False
),
in_c_key=False,
)
config.add(
"numpy__seterr_divide",
(
"Sets numpy's behavior for division by zero, see numpy.seterr. "
"'None' means using the default, defined by numpy__seterr_all."
),
EnumStr(
"None", ["ignore", "warn", "raise", "call", "print", "log"], mutable=False
),
in_c_key=False,
)
config.add(
"numpy__seterr_over",
(
"Sets numpy's behavior for floating-point overflow, "
"see numpy.seterr. "
"'None' means using the default, defined by numpy__seterr_all."
),
EnumStr(
"None", ["ignore", "warn", "raise", "call", "print", "log"], mutable=False
),
in_c_key=False,
)
config.add(
"numpy__seterr_under",
(
"Sets numpy's behavior for floating-point underflow, "
"see numpy.seterr. "
"'None' means using the default, defined by numpy__seterr_all."
),
EnumStr(
"None", ["ignore", "warn", "raise", "call", "print", "log"], mutable=False
),
in_c_key=False,
)
config.add(
"numpy__seterr_invalid",
(
"Sets numpy's behavior for invalid floating-point operation, "
"see numpy.seterr. "
"'None' means using the default, defined by numpy__seterr_all."
),
EnumStr(
"None", ["ignore", "warn", "raise", "call", "print", "log"], mutable=False
),
in_c_key=False,
)
###
# To disable some warning about old bug that are fixed now.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论