[theano] 01/01: add fixes-for-numpy-1.12.patch

Daniel Stender stender at moszumanska.debian.org
Mon Feb 13 17:26:52 UTC 2017


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

stender pushed a commit to branch master
in repository theano.

commit 7f513349da8df990c5bbb8ecda5d879610137424
Author: Daniel Stender <stender at debian.org>
Date:   Mon Feb 13 14:34:13 2017 +0100

    add fixes-for-numpy-1.12.patch
---
 debian/changelog                          |  7 +++
 debian/patches/fixes-for-numpy-1.12.patch | 80 +++++++++++++++++++++++++++++++
 debian/patches/series                     |  1 +
 3 files changed, 88 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 5099016..b7404c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+theano (0.8.2-4) unstable; urgency=medium
+
+  * add fixes-for-numpy-1.12.patch (Closes: #848764) [thanks to
+    Rebecca N. Palmer].
+
+ -- Daniel Stender <stender at debian.org>  Mon, 13 Feb 2017 15:04:06 +0100
+
 theano (0.8.2-3) unstable; urgency=medium
 
   * Upload to unstable.
diff --git a/debian/patches/fixes-for-numpy-1.12.patch b/debian/patches/fixes-for-numpy-1.12.patch
new file mode 100644
index 0000000..9845fd4
--- /dev/null
+++ b/debian/patches/fixes-for-numpy-1.12.patch
@@ -0,0 +1,80 @@
+Description: fix tests for Numpy 1.12
+ Collected fixes for passing Theano 0.8.2 tests with Numpy 1.12. Partly taken
+ from upstream repo, plus changes by Rebecca Palmer.
+Bug: https://github.com/Theano/Theano/issues/5396
+Bug-Debian: https://bugs.debian.org/848764
+Origin: https://github.com/Theano/Theano/commit/e8e01f4
+Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
+
+--- a/theano/sparse/tests/test_sp2.py
++++ b/theano/sparse/tests/test_sp2.py
+@@ -61,7 +61,7 @@
+ 
+ 
+ class BinomialTester(utt.InferShapeTester):
+-    n = tensor.scalar()
++    n = tensor.scalar(dtype='int64')
+     p = tensor.scalar()
+     shape = tensor.lvector()
+     _n = 5
+--- a/theano/tensor/tests/test_elemwise.py
++++ b/theano/tensor/tests/test_elemwise.py
+@@ -414,7 +414,11 @@
+                     zv = numpy.bitwise_or.reduce(zv, axis)
+             elif scalar_op == scalar.and_:
+                 for axis in reversed(sorted(tosum)):
+-                    zv = numpy.bitwise_and.reduce(zv, axis)
++                    if zv.shape[axis] == 0:
++                        # Theano and old numpy use +1 as 'AND of no elements', new numpy uses -1
++                        zv = numpy.abs(numpy.bitwise_and.reduce(zv, axis).astype('int8'))
++                    else:
++                        zv = numpy.bitwise_and.reduce(zv, axis)
+             elif scalar_op == scalar.xor:
+                 # There is no identity value for the xor function
+                 # So we can't support shape of dimensions 0.
+--- a/theano/tensor/tests/test_extra_ops.py
++++ b/theano/tensor/tests/test_extra_ops.py
+@@ -135,7 +135,7 @@
+     def test_bincountFn(self):
+         w = T.vector('w')
+         def ref(data, w=None, minlength=None):
+-            size = data.max() + 1
++            size = int(data.max()) + 1
+             if minlength:
+                 size = max(size, minlength)
+             if w is not None:
+--- a/theano/sparse/sandbox/sp2.py
++++ b/theano/sparse/sandbox/sp2.py
+@@ -4,6 +4,7 @@
+ import scipy.sparse
+ 
+ from theano import gof, tensor
++from theano.tensor import discrete_dtypes, float_dtypes
+ from theano.tensor.opt import register_specialize
+ from theano.sparse.basic import (
+     as_sparse_variable, SparseType, add_s_s, neg,
+@@ -115,6 +116,11 @@
+         n = tensor.as_tensor_variable(n)
+         p = tensor.as_tensor_variable(p)
+         shape = tensor.as_tensor_variable(shape)
++
++        assert n.dtype in discrete_dtypes
++        assert p.dtype in float_dtypes
++        assert shape.dtype in discrete_dtypes
++
+         return gof.Apply(self, [n, p, shape],
+                          [SparseType(dtype=self.dtype,
+                                      format=self.format)()])
+--- a/theano/tensor/signal/tests/test_pool.py
++++ b/theano/tensor/signal/tests/test_pool.py
+@@ -34,8 +34,8 @@
+             if input.shape[-1] % ds[1]:
+                 yi += 1
+         out_shp = list(input.shape[:-2])
+-        out_shp.append(input.shape[-2] / ds[0] + xi)
+-        out_shp.append(input.shape[-1] / ds[1] + yi)
++        out_shp.append(input.shape[-2] // ds[0] + xi)
++        out_shp.append(input.shape[-1] // ds[1] + yi)
+         output_val = numpy.zeros(out_shp)
+         func = numpy.max
+         if mode == 'sum':
diff --git a/debian/patches/series b/debian/patches/series
index 62d4949..2f48947 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
+fixes-for-numpy-1.12.patch
 strip-docs.patch

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



More information about the debian-science-commits mailing list