Shortcuts

torch.compiler.is_exporting

torch.compiler.is_exporting()[source][source]

Indicated whether we’re under exporting.

It’s stricter than is_compiling() flag, as it would only be set to True when torch.export is used.

Example:

>>> def forward(self, x):
>>>     if not torch.compiler.is_exporting():
>>>        pass # ...logic that is not needed in export...
>>>
>>>     # ...rest of the function...
Return type

bool

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources