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