summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Neidhardt <mail@ambrevar.xyz>2020-03-03 11:38:09 +0100
committerGuix Patches Tester <>2020-03-05 20:00:32 +0000
commit6b4f5e558b365793c4495cec783acbe0a1a5380d (patch)
tree7971f2ffe5f7fcefa7a60dabf85e2878442f9778
parent5d0f33c2ab9aa0cdc51a35525e895a603eac78ea (diff)
downloadpatches-series-3070.tar
patches-series-3070.tar.gz
gnu: python-keras: Fix tests.series-3070
* gnu/packages/machine-learning.scm (python-keras)[origin]: Add patch to remove unstable selu test. * gnu/local.mk: Include patch. * gnu/packages/patches/python-keras-selu-test.patch: New file.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/machine-learning.scm4
-rw-r--r--gnu/packages/patches/python-keras-selu-test.patch35
3 files changed, 39 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 22c11afd38..0a8d02fc9e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1326,6 +1326,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-configobj-setuptools.patch \
%D%/packages/patches/python-faker-fix-build-32bit.patch \
%D%/packages/patches/python-keras-integration-test.patch \
+ %D%/packages/patches/python-keras-selu-test.patch \
%D%/packages/patches/python-pep8-stdlib-tokenize-compat.patch \
%D%/packages/patches/python-pyfakefs-remove-bad-test.patch \
%D%/packages/patches/python-flint-includes.patch \
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 8262a418cc..7fbdef0163 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1863,7 +1863,9 @@ with image data, text data, and sequence data.")
(origin
(method url-fetch)
(uri (pypi-uri "Keras" version))
- (patches (search-patches "python-keras-integration-test.patch"))
+ (patches
+ (search-patches "python-keras-selu-test.patch" ; Numerically unstable?
+ "python-keras-integration-test.patch"))
(sha256
(base32
"1j8bsqzh49vjdxy6l1k4iwax5vpjzniynyd041xjavdzvfii1dlh"))))
diff --git a/gnu/packages/patches/python-keras-selu-test.patch b/gnu/packages/patches/python-keras-selu-test.patch
new file mode 100644
index 0000000000..68092d2593
--- /dev/null
+++ b/gnu/packages/patches/python-keras-selu-test.patch
@@ -0,0 +1,35 @@
+Disable unstable SELU test.
+See https://github.com/keras-team/keras/issues/13856.
+
+diff --git a/tests/keras/activations_test.py b/tests/keras/activations_test.py
+index 4c0bb36..5808c0f 100644
+--- a/tests/keras/activations_test.py
++++ b/tests/keras/activations_test.py
+@@ -208,24 +208,6 @@ def test_elu():
+ assert_allclose(result, true_result)
+
+
+-def test_selu():
+- x = K.placeholder(ndim=2)
+- f = K.function([x], [activations.selu(x)])
+- alpha = 1.6732632423543772848170429916717
+- scale = 1.0507009873554804934193349852946
+-
+- positive_values = get_standard_values()
+- result = f([positive_values])[0]
+- assert_allclose(result, positive_values * scale, rtol=1e-05)
+-
+- negative_values = np.array([[-1, -2]], dtype=K.floatx())
+-
+- result = f([negative_values])[0]
+- true_result = (np.exp(negative_values) - 1) * scale * alpha
+-
+- assert_allclose(result, true_result)
+-
+-
+ def test_tanh():
+ test_values = get_standard_values()
+
+--
+2.25.1
+