Rate this Page

torch.compiler.load_compiled_function#

torch.compiler.load_compiled_function(file, *, f_globals=None, external_data=None)[source]#

Load an aot-compiled function from a file.

Warning

This API is currently experimental and subject to change.

Parameters:
  • file (IOBase) – A file-like object containing the serialized compiled function.

  • f_globals (dict[str, object] | None) – Optional global scope enclosing the compiled function.

  • external_data (dict[str, Any] | None) – Optional data to be loaded into the runtime environment of the compiled function. This should contains the same data as AOTCompileResult.external_data returned from save_compiled_function() call.

Returns:

A torch-compiled function with compilation preloaded from disk.

Return type:

Callable[[…], Any]