onnx_diagnostic.torch_export_patches.onnx_export_errors

onnx_diagnostic.torch_export_patches.onnx_export_errors.patch_module_or_classes(mod, verbose: int = 0) Dict[type, Dict[type, Callable]][source][source]

Applies all patches defined in classes prefixed by patched_ cls._PATCHED_CLASS_ defines the class to patch, cls._PATCHES_ defines the method to patch. The returns information needs to be sent to unpatch_module_or_classes() to revert the changes.

Parameters:
  • mod – module of list of clsses to patch

  • verbose – verbosity

Returns:

patch info

onnx_diagnostic.torch_export_patches.onnx_export_errors.replacement_before_exporting(args: Any) Any[source][source]

Does replacements on the given inputs if needed.

onnx_diagnostic.torch_export_patches.onnx_export_errors.unpatch_module_or_classes(mod, info: Dict[type, Dict[type, Callable]], verbose: int = 0)[source][source]

Reverts modification made by patch_module_or_classes().

Parameters:
  • mod – module of list of clsses to patch

  • verbose – verbosity