Pytorch 2.2 adds a strict=False
option to torch.export
that is thus described in the docs:
strict (bool) – When enabled (default), the export function will trace the program through TorchDynamo which will ensure the soundness of the resulting graph. Otherwise, the exported program will not validate the implicit assumptions baked into the graph and may cause behavior divergence between the original model and the exported one. This is useful when users need to workaround bugs in the tracer, or simply want incrementally enable safety in their models. Note that this does not affect the resulting IR spec to be different and the model will be serialized in the same way regardless of what value is passed here. WARNING: This option is experimental and use this at your own risk.
-
What are the set of Python features that will be traced when
strict = False
but not otherwise? -
How does
strict = False
enable “incremental safety” in a model? -
What exactly happens when we set
strict = False
? Is a different tracer used, or is it still TorchDynamo?