Skip to content

[tensor-shapes] jax.numpy.reshape: support -1 dimensions - #5618

Closed
jakevdp wants to merge 1 commit into
meta:mainfrom
jakevdp:jax-reshape
Closed

jakevdp wants to merge 1 commit into
meta:mainfrom
jakevdp:jax-reshape

Conversation

@jakevdp

@jakevdp jakevdp commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Previously, Array.reshape(*shape: *NewShape) and jax.numpy.reshape(x, shape: NewShape) returned Array[NewShape] directly without evaluating reshape_shape. As a result, calls like a.reshape(n, -1) or jnp.reshape(a, (n, -1)) captured -1 as a literal Int[-1] dimension in the output shape, causing downstream shape and broadcasting errors.

This change generalizes the reshape_shape DSL functions to handle placeholder -1 dimensions uniformly across concrete, symbolic (Int[N]), and gradual shapes.

  • I am a human, and I fully understand the code I am submitting.

@meta-cla meta-cla Bot added the cla signed label Nov 11, 2026
@meta-codesync

meta-codesync Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D131294105. (Because this pull request was imported automatically, there will not be any future comments.)

@stroxler stroxler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync Bot closed this in 175a253 Nov 11, 2026
@meta-codesync

meta-codesync Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

This pull request has been merged in 175a253.

@meta-codesync meta-codesync Bot added the Merged label Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants