Bug#848764: (no subject)

Rebecca N. Palmer rebecca_palmer at zoho.com
Mon Feb 6 23:28:41 UTC 2017


Control: tags -1 patch

Three patches because this is logically three bugs, though it's filed as 
two upstream:
https://github.com/Theano/Theano/issues/5494
https://github.com/Theano/Theano/issues/5396
First patch taken from upstream 
https://github.com/Theano/Theano/commit/e8e01f4e0da83d038b244cd5dcec4f0d3f6c0777 
by chinnadhurai

(I've only tried these tests, not a full build; I can't reproduce the
other three failures reported in upstream 5396)

--- a/theano/sparse/tests/test_sp2.py
+++ b/theano/sparse/tests/test_sp2.py
@@ -61,7 +61,7 @@ class PoissonTester(utt.InferShapeTester):


 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 @@ class test_CAReduce(unittest_tools.InferShapeTester):
                     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 @@ class TestBinCountOp(utt.InferShapeTester):
     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:



More information about the debian-science-maintainers mailing list