[keras] 06/15: Fix autopkgtest and add a basic usage test.

Stephen Sinclair sinclairs-guest at moszumanska.debian.org
Mon Nov 20 16:40:16 UTC 2017


This is an automated email from the git hooks/post-receive script.

sinclairs-guest pushed a commit to branch master
in repository keras.

commit 21915c41f100bdbc893df4766be98226580f8143
Author: Stephen Sinclair <radarsat1 at gmail.com>
Date:   Fri Nov 17 00:15:26 2017 -0300

    Fix autopkgtest and add a basic usage test.
---
 debian/changelog                |  4 ++++
 debian/control                  |  1 +
 debian/tests/control            |  1 +
 debian/tests/python3-theano-cpu | 20 ++++++++++++++++----
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a11304a..9ef3826 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,10 @@
 keras (2.0.9-1) UNRELEASED; urgency=medium
 
   * Extend upstream copyright to 2017.
+  * Add autopkgtest
+    + Checks that module loads, optimizes a simple network.
+    + Add allow-stderr restriction because impossible to suppress
+      backend announcement ("Using Theano backend.") on stderr.
   * Add new package keras-doc:
     + Include docs built by mkdocs.
     + Patch to add missing images pulled from Keras website
diff --git a/debian/control b/debian/control
index d0007ae..8016b10 100644
--- a/debian/control
+++ b/debian/control
@@ -32,6 +32,7 @@ Depends:
  python3-numpy,
  python3-scipy,
  python3-h5py,
+ python3-theano,
  ${misc:Depends},
  ${python3:Depends}
 Description: deep learning framework running on Theano or TensorFlow
diff --git a/debian/tests/control b/debian/tests/control
index 7555d3b..b1d488d 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1,3 @@
 Tests: python3-theano-cpu
 Depends: python3-keras, python3-pytest
+Restrictions: allow-stderr
diff --git a/debian/tests/python3-theano-cpu b/debian/tests/python3-theano-cpu
index 8edfe0b..8f47816 100755
--- a/debian/tests/python3-theano-cpu
+++ b/debian/tests/python3-theano-cpu
@@ -1,13 +1,25 @@
 #!/bin/sh
 
+set -e
+
 # Tests must use Theano backend with CPU device
 export KERAS_BACKEND=theano
-export THEANO_FLAGS='device=cpu'
+export THEANO_FLAGS='device=cpu,cxx=,base_compiledir=/tmp'
 
 # python3.Y at build time, python3 at CI time
 PYINTERPRETER=${PYINTERPRETER:-python3}
 
-# Python module successfully imported and executed
-${PYINTERPRETER} -c 'import keras;'
+# Python module successfully imported
+${PYINTERPRETER} -c 'import keras'
 
-# Not supposed to run the actual unittests here so nothing more to do.
+# Execute a simple Keras script.
+${PYINTERPRETER} -c 'import keras
+x,y=[[0,0],[0,1],[1,0],[1,1]],[[0],[1],[1],[0]]
+inputs = keras.layers.Input(shape=(2,))
+a = keras.layers.Dense(3, activation="relu")(inputs)
+outputs = keras.layers.Dense(1)(a)
+model = keras.Model(inputs=inputs, outputs=outputs)
+model.compile(loss="mean_squared_error", optimizer="sgd", metrics=["accuracy"])
+model.fit(x, y, verbose=0, epochs=1000)
+loss, accuracy = model.evaluate(x, y, verbose=1)
+print("Test fraction correct (Accuracy) = {:.2f}".format(accuracy))'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/keras.git



More information about the debian-science-commits mailing list