Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected behaviour in dimension expansion #6790

Open
AlexanderWinterl opened this issue Jul 15, 2022 · 0 comments
Open

unexpected behaviour in dimension expansion #6790

AlexanderWinterl opened this issue Jul 15, 2022 · 0 comments

Comments

@AlexanderWinterl
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant