Repository: Theano/Theano

Issue:
theano test error
> > > theano.test()
> > > Theano version 0.8.0rc1.dev-260fc9a7af181dde0cd9c8f411bbdf3e4894f4c6
> > > theano is installed in /home/hzw/Downloads/Theano/theano
> > > NumPy version 1.10.4
> > > NumPy relaxed strides checking option: False
> > > NumPy is installed in /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy
> > > Python version 3.5.1 (default, Dec  7 2015, 12:58:09) [GCC 5.2.0]
> > > nose version 1.3.7
> > > /home/hzw/Downloads/Theano/theano/misc/pycuda_init.py:34: UserWarning: PyCUDA import failed in theano.misc.pycuda_init
> > >   warnings.warn("PyCUDA import failed in theano.misc.pycuda_init")
> > > /home/hzw/Downloads/Theano/theano/tensor/signal/downsample.py:6: UserWarning: downsample module has been moved to the theano.tensor.signal.pool module.
> > >   "downsample module has been moved to the theano.tensor.signal.pool module.")
> > > ....................S........................................S...................../home/hzw/Downloads/Theano/theano/compile/profilemode.py:84: UserWarning: DEPRECATION WARNING: The ProfileMode is deprecated. Use the Theano flags/parameter to theano.function 'profile=True' instead of 'mode=ProfileMode'
> > >   "DEPRECATION WARNING: The ProfileMode is deprecated. "
> > > ./home/hzw/Downloads/Theano/theano/compile/profilemode.py:84: UserWarning: DEPRECATION WARNING: The ProfileMode is deprecated. Use the Theano flags/parameter to theano.function 'profile=True' instead of 'mode=ProfileMode'
> > >   "DEPRECATION WARNING: The ProfileMode is deprecated. "
> > > ..../home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/lib/nanfunctions.py:326: RuntimeWarning: All-NaN slice encountered
> > >   warnings.warn("All-NaN slice encountered", RuntimeWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/lib/nanfunctions.py:227: RuntimeWarning: All-NaN axis encountered
> > >   warnings.warn("All-NaN axis encountered", RuntimeWarning)
> > > ............................................../home/hzw/Downloads/Theano/theano/gof/vm.py:818: UserWarning: CVM does not support memory profile, using Stack VM.
> > >   'CVM does not support memory profile, using Stack VM.')
> > > ./home/hzw/Downloads/Theano/theano/gof/vm.py:818: UserWarning: CVM does not support memory profile, using Stack VM.
> > >   'CVM does not support memory profile, using Stack VM.')
> > > ..............................0.058164613716645386
> > > 0.058164613716645386
> > > 0.058164613716645386
> > > 0.058164613716645386
> > > ............................................................................................................................................................SS..S...SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS./home/hzw/Downloads/Theano/theano/sandbox/gpuarray/type.py:772: UserWarning: config.experimental.unpickle_gpu_on_cpu is set to True. Unpickling GpuArray as numpy.ndarray
> > >   "config.experimental.unpickle_gpu_on_cpu is set to True. "
> > > .SSS...........S...........SSSSS..................SS................................................S...S.......................................
> > > .
> > > .
> > > ...........
> > > ....S...................S....................................................SSSSSSSSSSSSSS..................................../home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/data.py:61: ComplexWarning: Casting complex values to real discards the imaginary part
> > >   return self._with_data(self.data.astype(t))
> > > /home/hzw/Downloads/Theano/theano/sparse/tests/test_basic.py:2351: ComplexWarning: Casting complex values to real discards the imaginary part
> > >   expected = data.toarray().astype(o_dtype)
> > > ...../home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/compressed.py:730: SparseEfficiencyWarning: Changing the sparsity structure of a csc_matrix is expensive. lil_matrix is more efficient.
> > >   SparseEfficiencyWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/compressed.py:730: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.
> > >   SparseEfficiencyWarning)
> > > .............S.........................................S........S........................................../home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/csr.py:282: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
> > >   col.step in (1, None) and
> > > S...../home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/compressed.py:730: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.
> > >   SparseEfficiencyWarning)
> > > ................../home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/compressed.py:296: SparseEfficiencyWarning: Comparing sparse matrices using >= and <= is inefficient, using <, >, or !=, instead.
> > >   "using <, >, or !=, instead.", SparseEfficiencyWarning)
> > > .................../home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/compressed.py:730: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.
> > >   SparseEfficiencyWarning)
> > > ............./home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/compressed.py:730: SparseEfficiencyWarning: Changing the sparsity structure of a csc_matrix is expensive. lil_matrix is more efficient.
> > >   SparseEfficiencyWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/scipy/sparse/compressed.py:730: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.
> > >   SparseEfficiencyWarning)
> > > ...S..............S...............................................................................................................................................................S..SS............................................../home/hzw/Downloads/Theano/theano/tensor/signal/tests/test_conv.py:38: UserWarning: theano.tensor.signal.conv2d() now outputs a 2d tensor when both inputs are 2d. To disable this warning, set the Theano flag warn.signal_conv2d_interface to False
> > >   output = sym_conv2d(input, filters)
> > > ./usr/lib64/python3.5/unittest/case.py:600: UserWarning: theano.tensor.signal.conv2d() now outputs a 2d tensor when both inputs are 2d. To disable this warning, set the Theano flag warn.signal_conv2d_interface to False
> > >   testMethod()
> > > ....................ERROR (theano.gof.opt): EquilibriumOptimizer max'ed out by 'local_upcast_elemwise_constant_inputs'. You can safely raise the current threshold of 5.000000 with the theano flag 'optdb.max_use_ratio'.
> > > ERROR (theano.gof.opt): EquilibriumOptimizer max'ed out by 'local_upcast_elemwise_constant_inputs'. You can safely raise the current threshold of 5.000000 with the theano flag 'optdb.max_use_ratio'.
> > > ERROR (theano.gof.opt): EquilibriumOptimizer max'ed out by 'local_upcast_elemwise_constant_inputs'. You can safely raise the current threshold of 5.000000 with the theano flag 'optdb.max_use_ratio'.
> > > ERROR (theano.gof.opt): EquilibriumOptimizer max'ed out by 'local_upcast_elemwise_constant_inputs'. You can safely raise the current threshold of 5.000000 with the theano flag 'optdb.max_use_ratio'.
> > > ERROR (theano.gof.opt): EquilibriumOptimizer max'ed out by 'local_upcast_elemwise_constant_inputs'. You can safely raise the current threshold of 5.000000 with the theano flag 'optdb.max_use_ratio'.
> > > ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................./usr/lib64/python3.5/unittest/case.py:600: DeprecationWarning: stack(_tensors) interface is deprecated, use stack(tensors, axis=0) instead.
> > >   testMethod()
> > > ................................................................................................................................/home/hzw/Downloads/Theano/theano/tensor/tests/test_basic.py:7654: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [Tile(ndim)(advec, aivec_val)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_basic.py:7662: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [Tile(ndim)(admat, aivec_val)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_basic.py:7670: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [Tile(ndim)(adtens4, aivec_val)],
> > > .................................................................................................S....................................................................................................................................................................................................................................................................................................................................................S..SSSS.S............................................................./home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:146: DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
> > >   out = np.zeros(size, dtype=a.dtype)
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:142: DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
> > >   out = np.zeros(size, dtype=w.dtype)
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:146: DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
> > >   out = np.zeros(size, dtype=a.dtype)
> > > ./home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:193: UserWarning: Tile op is deprecated, use tile function instead.
> > >   f1 = theano.function([x], BinCountOp()(x, weights=None))
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:194: UserWarning: Tile op is deprecated, use tile function instead.
> > >   f2 = theano.function([x, w], BinCountOp()(x, weights=w))
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:201: UserWarning: Tile op is deprecated, use tile function instead.
> > >   f3 = theano.function([x], BinCountOp(minlength=23)(x, weights=None))
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:202: UserWarning: Tile op is deprecated, use tile function instead.
> > >   f4 = theano.function([x], BinCountOp(minlength=5)(x, weights=None))
> > > ./home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:225: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x,None)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:233: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:242: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=60)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:249: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=5)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:225: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x,None)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:233: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:242: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=60)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:249: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=5)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:225: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x,None)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:233: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:242: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=60)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:249: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=5)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:225: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x,None)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:233: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:242: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=60)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:249: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=5)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:225: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x,None)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:233: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:242: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=60)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:249: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=5)(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:225: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x,None)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:233: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp()(x, weights=weights)],
> > > /home/hzw/Downloads/Theano/theano/tensor/tests/test_extra_ops.py:242: UserWarning: Tile op is deprecated, use tile function instead.
> > >   [BinCountOp(minlength=60)(x, weights=weights)],
> > > ..........................S......................................................../home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/linalg/linalg.py:740: DeprecationWarning: The 'full' option is deprecated in favor of 'reduced'.
> > > For backward compatibility let mode default.
> > >   warnings.warn(msg, DeprecationWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/linalg/linalg.py:740: DeprecationWarning: The 'full' option is deprecated in favor of 'reduced'.
> > > For backward compatibility let mode default.
> > >   warnings.warn(msg, DeprecationWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/linalg/linalg.py:740: DeprecationWarning: The 'full' option is deprecated in favor of 'reduced'.
> > > For backward compatibility let mode default.
> > >   warnings.warn(msg, DeprecationWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/linalg/linalg.py:740: DeprecationWarning: The 'full' option is deprecated in favor of 'reduced'.
> > > For backward compatibility let mode default.
> > >   warnings.warn(msg, DeprecationWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/linalg/linalg.py:740: DeprecationWarning: The 'full' option is deprecated in favor of 'reduced'.
> > > For backward compatibility let mode default.
> > >   warnings.warn(msg, DeprecationWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/linalg/linalg.py:745: DeprecationWarning: The 'economic' option is deprecated.
> > >   warnings.warn(msg, DeprecationWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/linalg/linalg.py:745: DeprecationWarning: The 'economic' option is deprecated.
> > >   warnings.warn(msg, DeprecationWarning)
> > > /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy/linalg/linalg.py:745: DeprecationWarning: The 'economic' option is deprecated.
> > >   warnings.warn(msg, DeprecationWarning)
> > > ........../home/hzw/Downloads/Theano/theano/tensor/tests/test_opt.py:4022: UserWarning: Tile op is deprecated, use tile function instead.
> > >   f = theano.function([var], Tile(ndim)(var, (1,)_ndim), mode=mode)
> > > ...............................S.......................................................S.S..S.........SS...........................ERROR (theano.gof.opt): EquilibriumOptimizer max'ed out by 'local_add_canonizer'. You can safely raise the current threshold of 5.000000 with the theano flag 'optdb.max_use_ratio'.
> > > ...................S.......S............S..............................................................................................................................................................................E...............................................................................................................................S/usr/lib64/python3.5/unittest/case.py:600: UserWarning: consider_constant() is deprecated, use zero_grad() or disconnected_grad() instead.
> > >   testMethod()
> > > ./usr/lib64/python3.5/unittest/case.py:600: UserWarning: consider_constant() is deprecated, use zero_grad() or disconnected_grad() instead.
> > >   testMethod()
> > > ..........................................SS......SSSSS.../home/hzw/Downloads/Theano/theano/printing.py:744: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
> > >   _logger.warn("pydotprint: cond_highlight is set but there is no"
> > > ..../home/hzw/Downloads/Theano/theano/compile/profilemode.py:84: UserWarning: DEPRECATION WARNING: The ProfileMode is deprecated. Use the Theano flags/parameter to theano.function 'profile=True' instead of 'mode=ProfileMode'
> > >   "DEPRECATION WARNING: The ProfileMode is deprecated. "
> > > # ..................SS.....................
> > > ## ERROR: test_err_bound_list (theano.tensor.tests.test_subtensor.T_subtensor)
> > > 
> > > IndexError: index 4 is out of bounds for axis 0 with size 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hzw/Downloads/Theano/theano/compile/function_module.py", line 859, in **call**
    outputs = self.fn()
SystemError: <theano.gof.vm.CVM object at 0x7fba8ac1ac28> returned a result with an error set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hzw/Downloads/Theano/theano/tensor/tests/test_subtensor.py", line 515, in test_err_bound_list
    self.assertRaises(IndexError, g, shp)
  File "/usr/lib64/python3.5/unittest/case.py", line 727, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "/usr/lib64/python3.5/unittest/case.py", line 176, in handle
    callable_obj(_args, *_kwargs)
  File "/home/hzw/Downloads/Theano/theano/compile/function_module.py", line 871, in **call**
    storage_map=getattr(self.fn, 'storage_map', None))
  File "/home/hzw/Downloads/Theano/theano/gof/link.py", line 314, in raise_with_op
    reraise(exc_type, exc_value, exc_trace)
  File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/hzw/Downloads/Theano/theano/compile/function_module.py", line 859, in **call**
    outputs = self.fn()
SystemError: <theano.gof.vm.CVM object at 0x7fba8ac1ac28> returned a result with an error set
Apply node that caused the error: AdvancedIncSubtensor1{no_inplace,inc}(<TensorType(float32, matrix)>, TensorConstant{(1, 1) of 1.0}, <TensorType(int64, vector)>)
Toposort index: 0
Inputs types: [TensorType(float32, matrix), TensorType(float32, (True, True)), TensorType(int64, vector)]
Inputs shapes: [(2, 3), (1, 1), (2,)]
Inputs strides: [(12, 4), (4, 4), (8,)]
Inputs values: ['not shown', array([[ 1.]], dtype=float32), array([0, 4])]
Outputs clients: [['output']]

Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
  File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/suite.py", line 178, in **call**
    return self.run(_arg, *_kw)
  File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/suite.py", line 225, in run
    test(orig)
  File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/case.py", line 46, in **call**
    return self.run(_arg, *_kwarg)
  File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/case.py", line 134, in run
    self.runTest(result)
  File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/case.py", line 152, in runTest
    test(result)
  File "/usr/lib64/python3.5/unittest/case.py", line 648, in **call**
    return self.run(_args, *_kwds)
  File "/usr/lib64/python3.5/unittest/case.py", line 600, in run
    testMethod()
  File "/home/hzw/Downloads/Theano/theano/tensor/tests/test_subtensor.py", line 510, in test_err_bound_list
    inc_subtensor(t, numpy.asarray([[1.]], self.dtype)),

HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

---

Ran 2998 tests in 7644.263s

FAILED (SKIP=105, errors=1)

---

here is my config
[global]
device = cpu
floatX = float32

force_device = True                                                                                                                                           

[blas]  
ldflags = -lopenblas                                                                                                                                          
# [nvcc]
# fastmath = True

[cuda]  
root = /opt/cuda/ 



Discussion:
Hi,

It looks like python 3.5 is stricter in terms of how C extensions should
behave, as I cannot reproduce the issue with python 3.4, but I can wit
3.5. See [1].

I have an idea on how to fix it, I'll try to submit a PR.

In the mean time, the worse that is happening is that instead of an
IndexError, we see a SystemError wrapping that IndexError, so there
should be no issue for you except if you rely on that specific type of
error somewhere in your code (as we do in that test).

[1] https://bugs.python.org/issue23571

On Mon, Mar 21, 2016, hawklucky wrote:

> > > > theano.test()
> > > > Theano version 0.8.0rc1.dev-260fc9a7af181dde0cd9c8f411bbdf3e4894f4c6
> > > > theano is installed in /home/hzw/Downloads/Theano/theano
> > > > NumPy version 1.10.4
> > > > NumPy relaxed strides checking option: False
> > > > NumPy is installed in /home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/numpy
> > > > Python version 3.5.1 (default, Dec  7 2015, 12:58:09) [GCC 5.2.0]
> > > > 
> > > > # nose version 1.3.7
> > > > 
> > > > ## ERROR: test_err_bound_list (theano.tensor.tests.test_subtensor.T_subtensor)
> > > > 
> > > > IndexError: index 4 is out of bounds for axis 0 with size 2
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/home/hzw/Downloads/Theano/theano/compile/function_module.py", line 859, in **call**
>     outputs = self.fn()
> SystemError: <theano.gof.vm.CVM object at 0x7fba8ac1ac28> returned a result with an error set
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/home/hzw/Downloads/Theano/theano/tensor/tests/test_subtensor.py", line 515, in test_err_bound_list
>     self.assertRaises(IndexError, g, shp)
>   File "/usr/lib64/python3.5/unittest/case.py", line 727, in assertRaises
>     return context.handle('assertRaises', args, kwargs)
>   File "/usr/lib64/python3.5/unittest/case.py", line 176, in handle
>     callable_obj(_args, *_kwargs)
>   File "/home/hzw/Downloads/Theano/theano/compile/function_module.py", line 871, in **call**
>     storage_map=getattr(self.fn, 'storage_map', None))
>   File "/home/hzw/Downloads/Theano/theano/gof/link.py", line 314, in raise_with_op
>     reraise(exc_type, exc_value, exc_trace)
>   File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/six.py", line 685, in reraise
>     raise value.with_traceback(tb)
>   File "/home/hzw/Downloads/Theano/theano/compile/function_module.py", line 859, in **call**
>     outputs = self.fn()
> SystemError: <theano.gof.vm.CVM object at 0x7fba8ac1ac28> returned a result with an error set
> Apply node that caused the error: AdvancedIncSubtensor1{no_inplace,inc}(<TensorType(float32, matrix)>, TensorConstant{(1, 1) of 1.0}, <TensorType(int64, vector)>)
> Toposort index: 0
> Inputs types: [TensorType(float32, matrix), TensorType(float32, (True, True)), TensorType(int64, vector)]
> Inputs shapes: [(2, 3), (1, 1), (2,)]
> Inputs strides: [(12, 4), (4, 4), (8,)]
> Inputs values: ['not shown', array([[ 1.]], dtype=float32), array([0, 4])]
> Outputs clients: [['output']]
> 
> Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
>   File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/suite.py", line 178, in **call**
>     return self.run(_arg, *_kw)
>   File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/suite.py", line 225, in run
>     test(orig)
>   File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/case.py", line 46, in **call**
>     return self.run(_arg, *_kwarg)
>   File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/case.py", line 134, in run
>     self.runTest(result)
>   File "/home/hzw/Downloads/Theano/theanovenv/lib/python3.5/site-packages/nose/case.py", line 152, in runTest
>     test(result)
>   File "/usr/lib64/python3.5/unittest/case.py", line 648, in **call**
>     return self.run(_args, *_kwds)
>   File "/usr/lib64/python3.5/unittest/case.py", line 600, in run
>     testMethod()
>   File "/home/hzw/Downloads/Theano/theano/tensor/tests/test_subtensor.py", line 510, in test_err_bound_list
>     inc_subtensor(t, numpy.asarray([[1.]], self.dtype)),
> 
> HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.
> 
> ---
> 
> Ran 2998 tests in 7644.263s
> 
> FAILED (SKIP=105, errors=1)
> 
> ---
> 
> here is my config
> [global]
> device = cpu
> floatX = float32
> 
> force_device = True                                                                                                                                           
> 
> [blas]  
> ldflags = -lopenblas                                                                                                                                          
> 
> #[nvcc]  
> #fastmath = True                                                                                                                                              
> 
> [cuda]  
> root = /opt/cuda/ 
> 
> ---
> 
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly or view it on GitHub:
> https://github.com/Theano/Theano/issues/4276

## 

Pascal


Resolving patch:
diff --git a/theano/tensor/subtensor.py b/theano/tensor/subtensor.py
--- a/theano/tensor/subtensor.py
+++ b/theano/tensor/subtensor.py
@@ -1956,6 +1956,7 @@ def c_code(self, node, name, input_names, output_names, sub):
         copy_of_x = self.copy_of_x(x)
 
         return """
+        PyObject* rval = NULL;
         if (%(inplace)s)
         {
             if (%(x)s != %(out)s)
@@ -1971,12 +1972,16 @@ def c_code(self, node, name, input_names, output_names, sub):
             %(out)s = %(copy_of_x)s;
         }
         PyObject *arglist = Py_BuildValue("OOOi",%(out)s, %(idx)s, %(y)s, %(inc_or_set)d);
-        inplace_increment(NULL, arglist);
+        rval = inplace_increment(NULL, arglist);
         Py_XDECREF(arglist);
+        if (rval == NULL) {
+            %(fail)s;
+        }
+        Py_XDECREF(rval);
         """ % locals()
 
     def c_code_cache_version(self):
-        return (1,)
+        return (2,)
 
     def perform(self, node, inp, out_):
         # TODO opt to make this inplace


Test patch: