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

Fix Categorical.logp with take_along_axis #3572

Merged
merged 5 commits into from
Aug 17, 2019

Conversation

lucianopaz
Copy link
Contributor

This PR is essentially the same as #3563 but using take_along_axis instead of tt.choose in order to prevent the issues #3564 and #3567. The minor problem was that take_along_axis is implemented in numpy but not in theano, so I had to add a port of numpy's implementation to theano in our theanof.py script. I also added tests for the new theanof parts (these should be upstream in theano itself but given that theano is dead and they wont be cutting releases I think that it's better to keep take_along_axis here). This PR fixes #3535.

Copy link
Member

@ColCarroll ColCarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me -- thanks for the thorough testing!

it looks like you implemented this function a few times - in numpy and in theano! i added one comment to make it clear we can remove some funniness once numpy 1.18 gets released.

return tuple(fancy_index)


if hasattr(np, "take_along_axis"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if hasattr(np, "take_along_axis"):
# np.take_along_axis added in 1.18.0, so
# this can be removed once this version of numpy is required
if hasattr(np, "take_along_axis"):

@ColCarroll
Copy link
Member

looks good to merge once release notes are updated

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

Successfully merging this pull request may close these issues.

Memory Error: OrderedLogistic
4 participants