mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
c48c6913b5
Addresses https://github.com/pytorch/pytorch/issues/178930 Allow overriding the default torch.compile backend globally so that out-of-tree backend authors don't need to pass `backend=` at every call site. Follows the same pattern as `torch.set_default_dtype` and `torch.set_default_device`. Explicit `backend= arguments to torch.compile still take precedence. Usage: ```python import torch torch.compiler.set_default_backend("my_custom_backend") compiled_model = torch.compile(model) # uses "my_custom_backend" torch.compiler.set_default_backend(None) ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/178944 Approved by: https://github.com/anijain2305, https://github.com/williamwen42, https://github.com/mlazos
856 B
856 B
.. currentmodule:: torch.compiler
.. automodule:: torch.compiler
(torch.compiler_api)=
torch.compiler API reference
For a quick overview of torch.compiler, see {ref}torch.compiler_overview.
.. autosummary::
:toctree: generated
:nosignatures:
compile
reset
allow_in_graph
substitute_in_graph
assume_constant_result
list_backends
disable
set_default_backend
get_default_backend
set_stance
set_enable_guard_collectives
cudagraph_mark_step_begin
is_compiling
is_dynamo_compiling
is_exporting
keep_portable_guards_unsafe
skip_guard_on_inbuilt_nn_modules_unsafe
skip_guard_on_all_nn_modules_unsafe
keep_tensor_guards_unsafe
skip_guard_on_globals_unsafe
skip_all_guards_unsafe
nested_compile_region