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