nn0p
nn0p

Reputation: 1209

Why indexing a Theano tensor variable with a list of `slice` objects is invalid?

In an exercise of Dr. Goodfellow's Theano tutorial, it's ok to slice x with tuple (slice(w,-w), )*x.ndim, but Theano will raise exception for [slice(w,-w)]*x.ndim .

Exception info:

theano.tensor.var.AsTensorError: ('Cannot 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 doesn't it work with list? BTW, slicing a tensor variable with an integer list is ok. I've red the document, but didn't find the reason.

Upvotes: 3

Views: 1435

Answers (1)

Daniel Renshaw
Daniel Renshaw

Reputation: 34177

This was a bug in Theano. It has been fixed by Frédéric Bastien via https://github.com/Theano/Theano/pull/2992

More here: https://groups.google.com/forum/#!topic/theano-users/nTRfigJD19w

Upvotes: 1

Related Questions