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

jnp.zeros{,_like} no longer produces a Zero. #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

patrick-kidger
Copy link
Owner

This is from some discussion in #2. The existing approach is a little
bit magic.

This also means that we can probably remove dynamic tracing.

This is from some discussion in #2. The existing approach is a little
bit magic.

This also means that we can probably remove dynamic tracing.
patrick-kidger added a commit that referenced this pull request Dec 21, 2023
This existed just to allow for `jnp.zeros{,_like}` to produce Zeros
even though none of its inputs were. However we have now removed that
as "too magic" (#3), so means that we can simplify this too.
@nstarman
Copy link
Contributor

Has this PR been supplanted by later refactors?

@patrick-kidger
Copy link
Owner Author

Not necessarily. The thing I ended up changing was to add a dynamic flag here:

dynamic: bool = eqx.field(static=True)

If this flag is set then Quax will be ran against all primitive rules within its dynamic context. (Not just the ones it has data dependency on.) In practice the only one that affects is this one, since it's the only one without dependence on a Quax value.

So for now I've set that flag to False by default, and this rule is just never hit. I'd be open to allowing dynamic=True for power users, in which case this rule may come in useful again.

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

Successfully merging this pull request may close these issues.

2 participants