feat(array): pa.shape_struct returns any carrier with ShapeDtypeStruct data, for eval_shape and planning
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 57/100
Research direction
Start by reading the carrier pytree registrations and the existing adapter code in pipekit-array; the issue proposes using jax.tree.map and says the adapter’s rewrap is not needed. Check the existing tests for DimArray, CField, and jax.eval_shape to locate where to add coverage. Done means reductions on pa.shape_struct(x) preserve the expected dims and shape for both carriers, with lint, type checks, and tests green.
Written by the indexing model from the issue text.
Description
Problem / Request
Add pa.shape_struct(x), which returns the same carrier with every leaf replaced by a jax.ShapeDtypeStruct, so a pipeline can plan its outputs with jax.eval_shape before any data exists.
Motivation
The prototype built DimArray and CField on a ShapeDtypeStruct((3, 64, 64), float32) and jax.eval_shape of a mean over time gave dims ('y', 'x'). Nothing builds such a carrier from an existing one. coordax has shape_struct_field (CP-D8).
Proposed API
# Shapes: (time, y, x) = (3, 64, 64)
# proposed (CP-D8)
# carrier → the same carrier, leaves as ShapeDtypeStruct
spec = pa.shape_struct(x)
# today (pipekit-array)
# DimArray (time, y, x) → DimArray (y, x)
out = jax.eval_shape(lambda f: pa.reduce(f, jnp.mean, "time"), spec)
Reuse
jax.tree.mapover the carrier's pytree registration; the adapter'srewrapis not needed.
References & Existing Code
- Design:
docs/design/coordax_carriers.mdin jejjohnson/geostack (merged in jejjohnson/geostack#368), pattern 7. - Prototype:
q3_q7_rest.py, section Q7.
Definition of Done
-
eval_shapeof a reduction onpa.shape_struct(x)gives the dims and shape of running it, forDimArrayandCField. - Lint, type check and tests green.
Relationships
- Parent: jejjohnson/geostack#369
- Blocks: jejjohnson/geotoolz#853
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 3h 50m
- Merged PRs (30d)
- 143
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from jejjohnson/pipekit
-
area:code layer:0-primitives priority:p2 type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jejjohnson/pipekit#296 ·
Maintainers usually reply within 1 day
-
area:code type:feature
Difficulty 4/5 3-5 days Newbie friendliness 48/100
jejjohnson/pipekit#410 ·
Maintainers usually reply within 1 day
-
area:code type:feature
Difficulty 5/5 Over a week Newbie friendliness 38/100
jejjohnson/pipekit#409 ·
Maintainers usually reply within 1 day
-
area:code type:feature
Difficulty 3/5 1-2 days Newbie friendliness 75/100
jejjohnson/pipekit#408 ·
Maintainers usually reply within 1 day
-
area:code type:feature
Difficulty 4/5 3-5 days Newbie friendliness 48/100
jejjohnson/pipekit#407 ·
Maintainers usually reply within 1 day
All issues in jejjohnson/pipekit
Similar issues
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainers usually reply within 1 day