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

Omni-staging and IntEnum: No constant handler for type error #4289

Closed
balancap opened this issue Sep 15, 2020 · 2 comments · Fixed by #6130
Closed

Omni-staging and IntEnum: No constant handler for type error #4289

balancap opened this issue Sep 15, 2020 · 2 comments · Fixed by #6130
Assignees
Labels
bug Something isn't working

Comments

@balancap
Copy link

Out of curiosity, I wanted to test the new omni-staging on the code I have developed. And I noticed a new error, not existing before:

TypeError: No constant handler for type: <enum 'CCADimensions'>

I am using this IntEnum as a named vector indexing in some jit methods, and I guess the error is related to the different way omni-staging is handling constants.

I could solve the problem using some internals Jax methods:

from functools import partial
from jax.lib.xla_bridge import _python_scalar_handler, register_constant_handler
register_constant_handler(CCADimensions, partial(_python_scalar_handler, np.dtype(np.int32)))

Is there a plan to fix the support of IntEnum constants? Or add a helper method to allow users to register custom IntEnum as constants?

@mattjj
Copy link
Collaborator

mattjj commented Mar 19, 2021

Sorry for not following up on this before! It came up again in #6129, and I think #6130 should fix it. (If it doesn't, please share a minimal repro where it fails, though I'm pretty sure it fixes the issue!)

@mattjj mattjj self-assigned this Mar 19, 2021
@mattjj mattjj added the bug Something isn't working label Mar 19, 2021
@balancap
Copy link
Author

Thanks a lot @mattjj I'll make sure it fixes my issue too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants