Rate this Page

torch.compiler.is_dynamo_compiling#

torch.compiler.is_dynamo_compiling()[source]#

Indicates whether a graph is traced via TorchDynamo.

It’s stricter than is_compiling() flag, as it would only be set to True whenTorchDynamo is used.

Example:

>>>defforward(self,x):>>>ifnottorch.compiler.is_dynamo_compiling():>>>pass# ...logic that is not needed in a TorchDynamo-traced graph...>>>>>># ...rest of the function...
Return type

bool