-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
Allow StateIndex to be passed dynamically #843
Conversation
9d4528c
to
6ed3c57
Compare
If this is acceptable, I'm happy to add some methods if you want to make the code more polished: class StateIndex:
def initial_value(self):
return self.init[0]
def initial_value_deleted(self):
return self.init == () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you suggest in #842, I think it'd be better to replace ()
with a sentinel value that is a empty pytree, just to help emphasise what's going on.
I don't think you need to wrap the initial value into a length-1 tuple? Just the original value should work, I think.
7db8934
to
572b72f
Compare
Errors fixed, but I have some questions about the code. I don't understand why |
Indeed, I think |
Interesting, okay. You may want to consider adding a comment if that's behavior that you're counting on in for some use cases. (Sorry I've been struggling with COVID all week, and my brain's a bit slower than usual.)
I tried that, but couldn't get it to pass the tests. Anyway, I do love how the interface of |
Honestly, I'm not sure that'd be good behaviour to rely on... ! It's certainly not the usual path. I'd be happy to change that without considering it a compatibility break. Lmk where you land on all of this + when you want a review of this PR. (Once it's passing tests.) |
Great! If I have time, I'll take a look at this again.
Hmmm, it passes the tests on my machine on Python 3.11 (the failing test), and 3.12. I'm not sure how to debug this. Do you have any insight into this by any chance? |
It does seem a bit weird! |
I'm not sure, but I tested with the previous release Jax 0.4.31, whereas the test ran with the new release. I'll re-run the job. But the error
is related to Equinox, right? I'm not sure how closure conversion works since I haven't used it yet. |
572b72f
to
59d21d9
Compare
(Looks like this passes now.) |
59d21d9
to
262728e
Compare
@patrick-kidger Do you have time to take a look at this? |
Yup, I do! Have been otherwise engaged this past week. I expect to have a look at this in the next couple of days :) |
No worries, take your time :) |
Okay, LGTM -- merged! Thank you for the contribution :) |
Fixes #842