While using pymc3 I ran into some FutureWarning's while performing advanced indexing on a tensor variable. This is a minimal code that reproduces the warning (treated as an exception) along with its traceback.
import warnings
import numpy as np
import theano
from theano import tensor
theano.config.compute_test_value = 'raise'
with warnings.catch_warnings(record=True) as w:
# Cause all warnings to always be triggered.
warnings.simplefilter("error")
n = 10
size = 1000
a = np.random.randn(n)
inds = np.random.randint(0, n, size=size)
A = tensor.dvector('A')
A.tag.test_value = a
B = A[inds, None]
The traceback is the following
File "/home/lpaz/Dropbox/Luciano/issue pymc3/theano_warn.py", line 28, in <module>
B = A[inds, None]
File "/home/lpaz/anaconda3/lib/python3.6/site-packages/theano/tensor/var.py", line 572, in __getitem__
return theano.tensor.subtensor.advanced_subtensor(self, *args)
File "/home/lpaz/anaconda3/lib/python3.6/site-packages/theano/gof/op.py", line 674, in __call__
required = thunk()
File "/home/lpaz/anaconda3/lib/python3.6/site-packages/theano/gof/op.py", line 892, in rval
r = p(n, [x[0] for x in i], o)
File "/home/lpaz/anaconda3/lib/python3.6/site-packages/theano/tensor/subtensor.py", line 2190, in perform
rval = inputs[0].__getitem__(inputs[1:])
FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use
`arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index,
`arr[np.array(seq)]`, which will result either in an error or a different result.
Which version of NumPy do you use?
I suppose a new version of NumPy is breaking stuff.
But I do not understand why they tell this should be a warning, but it
break Theano.
On Tue, Dec 11, 2018 at 9:10 AM Luciano Paz notifications@github.com
wrote:
While using pymc3 I ran into some FutureWarning's while performing
advanced indexing on a tensor variable. This is a minimal code that
reproduces the warning (treated as an exception) along with its traceback.import warningsimport numpy as npimport theanofrom theano import tensor
theano.config.compute_test_value = 'raise'
with warnings.catch_warnings(record=True) as w:
# Cause all warnings to always be triggered.
warnings.simplefilter("error")
n = 10
size = 1000a = np.random.randn(n) inds = np.random.randint(0, n, size=size) A = tensor.dvector('A') A.tag.test_value = a B = A[inds, None]The traceback is the following
File "/home/lpaz/Dropbox/Luciano/issue pymc3/theano_warn.py", line 28, in
B = A[inds, None]File "/home/lpaz/anaconda3/lib/python3.6/site-packages/theano/tensor/var.py", line 572, in __getitem__
return theano.tensor.subtensor.advanced_subtensor(self, *args)File "/home/lpaz/anaconda3/lib/python3.6/site-packages/theano/gof/op.py", line 674, in __call__
required = thunk()File "/home/lpaz/anaconda3/lib/python3.6/site-packages/theano/gof/op.py", line 892, in rval
r = p(n, [x[0] for x in i], o)File "/home/lpaz/anaconda3/lib/python3.6/site-packages/theano/tensor/subtensor.py", line 2190, in perform
rval = inputs[0].__getitem__(inputs[1:])FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use
arr[tuple(seq)]instead ofarr[seq]. In the future this will be interpreted as an array index,
arr[np.array(seq)], which will result either in an error or a different result.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Theano/Theano/issues/6667, or mute the thread
https://github.com/notifications/unsubscribe-auth/AALC-4387ZtMLMYELvj9ckm--si7-2dYks5u37zjgaJpZM4ZNfH4
.
The version of numpy that I'm using is 1.15.4. This does not break theano, it's a regular warning. I just treated it as an exception with this block
with warnings.catch_warnings(record=True) as w:
# Cause all warnings to always be triggered.
warnings.simplefilter("error")
to get the full traceback to what was actually raising the warning
Closed by #6703
Hi @lucianopaz! Is this issue supposed to be resolved now?
Because it looks like the FutureWarning is still here.
Thanks!
@alexandorra, It's fixed on theano's master branch. The thing is that they haven't made a new release of theano to make the fix available to anyone that tries to simply pip install --upgrade theano
Oooh ok, thanks Luciano! So I guess the fix would have to be made on Theano-PyMC 🤔
@twiecki was planning on cutting a release here
@lucianopaz Actually I wanted to use this opportunity to cut over to our fork.
Most helpful comment
@lucianopaz Actually I wanted to use this opportunity to cut over to our fork.