pytorch - 💡(How to fix) Fix Support unbacked in export Dim API. [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#179176Fetched 2026-04-08 02:33:00
View on GitHub
Comments
0
Participants
1
Timeline
20
Reactions
0
Participants
Assignees
Timeline (top)
mentioned ×8subscribed ×8labeled ×3assigned ×1

Code Example

dynamic_shapes = {
   "x": {0:  Dim("batch1", min=1, max=100, unbacked=True)},
   "y": {0:  Dim("batch1", min=1, max=100,  unbacked=True)},
}
RAW_BUFFERClick to expand / collapse

some context https://docs.google.com/document/d/17VMPSBflbQ0zCl-r2WkCRCH4t06PlrVoruFR0TkTy5M/edit?tab=t.0#heading=h.gq9bcerm8ep1

TLDR:
We want to support unbacked in export Named Dims someone shall be able to say :

dynamic_shapes = {
   "x": {0:  Dim("batch1", min=1, max=100, unbacked=True)},
   "y": {0:  Dim("batch1", min=1, max=100,  unbacked=True)},
}
  1. This shall elevate the user experience! since Named dims in export imposes restriction that all shapes restrictions (guards) are encoded in spec. with the unbacked we "auto learn" restrictions that are encoded with torch._checks and not require users to be explicit about them. (see the example in the doc above).

  2. Shall we enable by default for named dims? at least for export? probably yes as step2 i do not forsee any regression regressions due to that.

Note: We want to extend the export dynamic shapes specs to be supported in compile in the near future.

cc @chauhang @penguinwu @avikchaudhuri @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4

extent analysis

TL;DR

Enable support for unbacked Named Dimensions in export by modifying the dynamic shapes specification to include the unbacked=True parameter.

Guidance

  • Review the provided Google Doc for context and examples of the desired functionality.
  • Update the dynamic shapes specification to include the unbacked=True parameter for Named Dimensions, as shown in the example: dynamic_shapes = {"x": {0: Dim("batch1", min=1, max=100, unbacked=True)}}.
  • Consider enabling this feature by default for named dims in export, as it is expected to improve user experience without introducing regressions.
  • Plan to extend this support to compile in the near future.

Example

dynamic_shapes = {
   "x": {0: Dim("batch1", min=1, max=100, unbacked=True)},
   "y": {0: Dim("batch1", min=1, max=100, unbacked=True)},
}

Notes

The implementation details and potential edge cases are not explicitly stated in the issue, so further review and testing may be necessary to ensure a smooth rollout of this feature.

Recommendation

Apply workaround: Enable support for unbacked Named Dimensions in export, as it is expected to improve user experience without introducing regressions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING