[export] backed_size_oblivious tutorial#3400
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3400
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 49f3b0d with merge base 8476a99 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| } | ||
|
|
||
| ###################################################################### | ||
| # (experimental) Avoiding 0/1 specialization |
There was a problem hiding this comment.
should this be added after the section on 0/1 specialization? or move the section on 0/1 specialization to right before here?
| # (experimental) Avoiding 0/1 specialization | ||
| # ^^^^^^^^^^^^^^^^^^ | ||
| # | ||
| # Export provides an experimental option to avoid specializing on size 0/1 sample inputs. Users can turn on `torch.fx.experimental._config.backed_size_oblivious = True` to enable this behavior. |
There was a problem hiding this comment.
| # Export provides an experimental option to avoid specializing on size 0/1 sample inputs. Users can turn on `torch.fx.experimental._config.backed_size_oblivious = True` to enable this behavior. | |
| # Export provides an experimental option to avoid specializing on size 0/1 sample inputs. Users can turn on ``torch.fx.experimental._config.backed_size_oblivious = True`` to enable this behavior. |
| y = torch.randn(1) | ||
| dynamic_shapes = {"x": (Dim.AUTO, Dim.AUTO), "y": (Dim.AUTO,)} | ||
| with torch.fx.experimental._config.patch(backed_size_oblivious=True): | ||
| ep = export(Foo(), (x, y), dynamic_shapes=dynamic_shapes) |
| ep = export(Foo(), (x, y), dynamic_shapes=dynamic_shapes) | ||
| ep.module()(torch.randn(8, 1), torch.randn(1)) | ||
| ep.module()(torch.randn(5, 6), torch.randn(6)) | ||
|
|
There was a problem hiding this comment.
i wonder if it would be good to add an example where the behavior is weir after setting backed_size_oblivious. your example here is a little simple.
|
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
Fixes #ISSUE_NUMBER
Description
Adds an export tutorial section for avoiding 0/1 specialization
Checklist
cc @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4