評價此頁

torch.compiler.is_exporting#

torch.compiler.is_exporting()[原始碼]#

指示我們是否正在匯出。

這比 is_compiling() 標誌更嚴格,因為它僅在 torch.export 被使用時才設定為 True。

示例

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

布林值