Why is indexing an Anano tensor variable with a list of `slice` objects invalid?
In Dr. Goodfellow Teano's exercise tutorial, it is okay to slice x
using a tuple (slice(w,-w), )*x.ndim
, but Theano will be an exception [slice(w,-w)]*x.ndim
.
Exception information:
theano.tensor.var.AsTensorError: ('Unable to convert [slice (, Elemwise {neg, no_inplace} .0, None), slice (, Elemwise {neg, no_inplace} .0, None), slice (, Elemwise {neg, no_inplace} .0, None)] to TensorType ',)
Why isn't he working with list
? BTW, slicing a tensor variable with a whole list is fine. I blamed the document but couldn't find the reason.
source to share
This was a mistake in Theano. It was fixed by Frederic Bastien via https://github.com/Theano/Theano/pull/2992
More details here: https://groups.google.com/forum/#!topic/theano-users/nTRfigJD19w
source to share