patrick-kidger / patrick-kidger/jaxtyping
Can dtypes of later arguments be annotated to follow the dtypes of earlier arguments?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 96
- PR merge metrics
- No merged PRs in 30d
Description
Consider the function
def fill_array(array: Shaped[Array, "N"], fill_value: Any) -> Shaped[Array, "N"]:
return jnp.full_like(array, fill_value)
In principle, the dtypes of fill_value and the return value should be constrained to be same as that of the input array. E.g., if I pass in an array of Integers, I should not specify a Float as the fill_value. Is it possible to annotate this constraint?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names the fill_array example and jnp.full_like, but no repository files or tests. Start by tracing how jaxtyping expresses array dtypes and whether annotations can relate fill_value and the return value to the input array. Done means establishing whether this constraint is supported and, if so, adding the corresponding implementation and coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100