torch.compiler.is_dynamo_compiling¶
- torch.compiler.is_dynamo_compiling()[來源][來源]¶
指示圖是否透過 TorchDynamo 追蹤。
它比 is_compiling() 標記更嚴格,因為只有在使用 TorchDynamo 時才會設定為 True。
範例
>>> def forward(self, x): >>> if not torch.compiler.is_dynamo_compiling(): >>> pass # ...logic that is not needed in a TorchDynamo-traced graph... >>> >>> # ...rest of the function...
- 返回類型