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... 返回型別 bool