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

Use multipledispatch for kl_divergence #762

Closed
fehiepsi opened this issue Sep 29, 2020 · 2 comments · Fixed by #1252
Closed

Use multipledispatch for kl_divergence #762

fehiepsi opened this issue Sep 29, 2020 · 2 comments · Fixed by #1252
Labels
enhancement New feature or request refactor
Milestone

Comments

@fehiepsi
Copy link
Member

As @fritzo's suggestion in #748, we can use multipledispatch to simplify dispatching work in kl_divergence (and possibly in biject_to too?). We can do this when funsor becomes the main dependency of numpyro.

@fehiepsi fehiepsi added the enhancement New feature or request label Sep 29, 2020
@fritzo
Copy link
Member

fritzo commented Sep 29, 2020

For biject_to you could simply use Python 3's builtin singledispatch which requires no extra dependencies. We use that in Funsor for single dispatch. We had avoided that in PyTorch because PyTorch originally supported Python 2 which is missing singledispatch.

@fehiepsi
Copy link
Member Author

Thanks for reviewing, @fritzo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants