Skip to content

Commit

Permalink
[export] Graph break on nn.Parameter construction
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
anijain2305 committed Jun 18, 2024
1 parent f7eae27 commit c223eac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions torch/_dynamo/variables/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,9 @@ def handle_ntuple(value):
@classmethod
def call_nn_parameter(cls, tx, data=None, requires_grad=True):
"""A call to torch.nn.Parameter() gets lifted to before the graph"""
if tx.export:
unimplemented("nn parameter construction not supported with export")

if isinstance(requires_grad, variables.VariableTracker):
try:
requires_grad = requires_grad.as_python_constant()
Expand Down

0 comments on commit c223eac

Please sign in to comment.