Skip to content

ScalarLike now dispatches to jaxtyping.ArrayLike rather than jax.typing.ArrayLike. This causes better behaviour during docgen.#297

Merged
patrick-kidger merged 1 commit intomainfrom
patrick/scalarlike
Feb 15, 2025
Merged

ScalarLike now dispatches to jaxtyping.ArrayLike rather than jax.typing.ArrayLike. This causes better behaviour during docgen.#297
patrick-kidger merged 1 commit intomainfrom
patrick/scalarlike

Conversation

@patrick-kidger
Copy link
Owner

No description provided.

…ng.ArrayLike. This causes better behaviour during docgen.
@patrick-kidger patrick-kidger merged commit d3c6b0f into main Feb 15, 2025
4 checks passed
@patrick-kidger patrick-kidger deleted the patrick/scalarlike branch February 15, 2025 09:06
@johannahaffner
Copy link

Commenting here since it's on topic: I still think that there are some cases where it would be nice to have the more concise expression of jaxtyping ScalarLike. Look at this madness - no one can read that anymore:

Screenshot 2025-03-02 at 12 49 49

@johannahaffner
Copy link

To err on the side of caution, we could introduce this only for Scalar and ScalarLike and add a reference that points to the union of types they express. A little info box could go on the pages for searches and descents, since this is where we mainly run into that problem (there is currently only one solver that takes a parameter like this at initialisation - this is IndirectLevenbergMarquardt).

@patrick-kidger
Copy link
Owner Author

Youch! This is indeed pretty rough.

That's not intended though -- it should display as just the string ArrayLike:

if getattr(typing, "GENERATING_DOCUMENTATION", False):

Something's clearly going wrong there 😅

@johannahaffner
Copy link

Oh sorry for the false alarm! I had double checked that I'm on jaxtyping 0.2.38, from two weeks ago, and verified that his PR was also accepted two weeks ago - it is just not yet in the latest release, and I missed that.

Anyway, you did good fixing that behaviour 😃

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