torch.compiler.is_dynamo_compiling¶
- torch.compiler.is_dynamo_compiling()[source][source]¶
指示圖是否透過 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...
- 返回型別