Blob Blame History Raw
--- theano/tensor/nnet/tests/test_blocksparse.py.orig	2020-07-27 10:09:29.000000000 -0600
+++ theano/tensor/nnet/tests/test_blocksparse.py	2020-08-07 08:05:19.415353280 -0600
@@ -42,11 +42,11 @@ class BlockSparse_Gemv_and_Outer(utt.Inf
 
         input = randn(batchSize, inputWindowSize, inputSize).astype('float32')
         permutation = np.random.permutation
-        inputIndice = np.vstack(permutation(nInputBlock)[:inputWindowSize]
-                                for _ in range(batchSize)).astype('int32')
+        inputIndice = np.vstack(list(permutation(nInputBlock)[:inputWindowSize]
+                                     for _ in range(batchSize))).astype('int32')
         outputIndice = np.vstack(
-            permutation(nOutputBlock)[:outputWindowSize]
-            for _ in range(batchSize)).astype('int32')
+            list(permutation(nOutputBlock)[:outputWindowSize]
+                 for _ in range(batchSize))).astype('int32')
         weight = randn(nInputBlock, nOutputBlock,
                        inputSize, outputSize).astype('float32')
         bias = randn(nOutputBlock, outputSize).astype('float32')
@@ -67,10 +67,10 @@ class BlockSparse_Gemv_and_Outer(utt.Inf
         x = randn(batchSize, xWindowSize, xSize).astype('float32')
         y = randn(batchSize, yWindowSize, ySize).astype('float32')
         randint = np.random.randint
-        xIdx = np.vstack(randint(0, nInputBlock, size=xWindowSize)
-                         for _ in range(batchSize)).astype('int32')
-        yIdx = np.vstack(randint(0, nOutputBlock, size=yWindowSize)
-                         for _ in range(batchSize)).astype('int32')
+        xIdx = np.vstack(list(randint(0, nInputBlock, size=xWindowSize)
+                              for _ in range(batchSize))).astype('int32')
+        yIdx = np.vstack(list(randint(0, nOutputBlock, size=yWindowSize)
+                              for _ in range(batchSize))).astype('int32')
 
         return o, x, y, xIdx, yIdx
 
--- theano/tensor/signal/tests/test_pool.py.orig	2020-07-27 10:09:29.000000000 -0600
+++ theano/tensor/signal/tests/test_pool.py	2020-08-07 08:05:19.416353279 -0600
@@ -196,7 +196,7 @@ class TestDownsampleFactorMax(utt.InferS
                         r_stride = builtins.max(r_stride, pad[i])
                         r_end = builtins.min(r_end, input.shape[-nd + i] + pad[i])
                     region.append(slice(r_stride, r_end))
-                patch = padded_input[l][region]
+                patch = padded_input[l][tuple(region)]
                 output_val[l][r] = func(patch)
         return output_val
 
@@ -303,7 +303,7 @@ class TestDownsampleFactorMax(utt.InferS
                     r_stride = r[i] * stride[i]
                     r_end = builtins.min(r_stride + ws[i], input.shape[-nd + i])
                     region.append(slice(r_stride, r_end))
-                patch = input[l][region]
+                patch = input[l][tuple(region)]
                 output_val[l][r] = func(patch)
         return output_val
 
--- theano/tensor/sort.py.orig	2020-07-27 10:09:29.000000000 -0600
+++ theano/tensor/sort.py	2020-08-07 08:05:19.417353279 -0600
@@ -279,10 +279,10 @@ def _topk_py_impl(op, x, k, axis, idx_dt
     idx[axis] = (slice(-k, None) if k > 0 else slice(-k))
 
     if not op.return_indices:
-        zv = np.partition(x, -k, axis=axis)[idx]
+        zv = np.partition(x, -k, axis=axis)[tuple(idx)]
         return zv
     elif op.return_values:
-        zi = np.argpartition(x, -k, axis=axis)[idx]
+        zi = np.argpartition(x, -k, axis=axis)[tuple(idx)]
         idx2 = tuple(
             np.arange(s).reshape(
                 (s,) + (1,) * (ndim - i - 1)
@@ -290,7 +290,7 @@ def _topk_py_impl(op, x, k, axis, idx_dt
         zv = x[idx2]
         return zv, zi.astype(idx_dtype)
     else:
-        zi = np.argpartition(x, -k, axis=axis)[idx]
+        zi = np.argpartition(x, -k, axis=axis)[tuple(idx)]
         return zi.astype(idx_dtype)
 
 
--- theano/tensor/tests/test_subtensor.py.orig	2020-07-27 10:09:29.000000000 -0600
+++ theano/tensor/tests/test_subtensor.py	2020-08-07 13:00:03.256695604 -0600
@@ -320,7 +320,7 @@ class T_subtensor(unittest.TestCase, utt
         x = theano.tensor.arange(100).reshape((5, 5, 4))
         res = x[[slice(1, -1)] * x.ndim].eval()
         x = np.arange(100).reshape((5, 5, 4))
-        np.allclose(res, x[[slice(1, -1)] * x.ndim])
+        np.allclose(res, x[tuple([slice(1, -1)] * x.ndim)])
 
     def test_slice_symbol(self):
         x = self.shared(np.random.rand(5, 4).astype(self.dtype))
@@ -360,7 +360,7 @@ class T_subtensor(unittest.TestCase, utt
     def test_boolean(self):
         def numpy_inc_subtensor(x, idx, a):
             x = x.copy()
-            x[idx] += a
+            x[tuple(idx)] += a
             return x
 
         numpy_n = np.arange(6, dtype=self.dtype).reshape((2, 3))