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

Support use under PyTorch jit #77

Merged
merged 1 commit into from
Dec 7, 2018
Merged

Conversation

fritzo
Copy link
Contributor

@fritzo fritzo commented Dec 6, 2018

Description

This fixes path optimizers to work when run under the PyTorch jit. The problem was that when running under the jit, x.shape is a tensor, and x.shape[pos] is also a tensor. These tensors can't be operated on as easily as ints. this PR merely casts to an int. Note this will still raise a warning in the PyTorch jit, but it is easy to filter out the warning; typically we want to optimize the path once, then replay compiled code multiple times assume tensor shapes are roughly similar.

Tested

  • ran locally, showing that this fixes some jit usage in Pyro

Status

  • Ready to go

@codecov-io
Copy link

Codecov Report

Merging #77 into master will not change coverage.
The diff coverage is 100%.

Copy link
Owner

@dgasmith dgasmith left a comment

Choose a reason for hiding this comment

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

Interesting, thanks for the fix.

@dgasmith
Copy link
Owner

dgasmith commented Dec 7, 2018

Will you need a 2.3.x release for this?

@dgasmith dgasmith merged commit c58e187 into dgasmith:master Dec 7, 2018
@fritzo
Copy link
Contributor Author

fritzo commented Dec 7, 2018

Will you need a 2.3.x release for this?

A 2.3.x release would be great 👍 We currently patch opt_einsum to work around this issue, and we can remove the gross patch as soon as opt_einsum is released. Thanks!

@dgasmith
Copy link
Owner

dgasmith commented Dec 9, 2018

Ok, 2.3.2 out with this patch in on PyPI. Should on conda-forge in a few hours.

@fritzo
Copy link
Contributor Author

fritzo commented Dec 9, 2018

Thanks, @dgasmith !

@dgasmith dgasmith added this to the v3.0 milestone Jul 3, 2019
@dgasmith dgasmith added the bug label Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants