unexpected behaviour in dimension expansion
AlexanderWinterl opened this issue · comments
When working with pymc3 (3.11.2) and theano (1.1.2) I found that dimension expansion of theano tensors shows some unexpected behaviour, compared to numpy style advanced indexing.
This code works:
import theano.tensor as T
A = T.zeros((3,4))
B = A[None,:,:]
While leaving out the last axis indexer raises a ValueError:
import theano.tensor as T
A = T.zeros((3,4))
B = A[None,:]
ValueError: ('You cannot drop a non-broadcastable dimension.', ([False, False], ['x', 0]))
In numpy you can usually leave out trailing ",:" axis indexers. In theano it seems they are necessary so the dimshuffle functions works correctly.
I don't know if this is fixed in any new version or if it is necessary to fix it at all. I just want to drop this somewhere on the internet for other people to find it, because that error annoyed me for a long time.