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
Please see the Writing documentation section of CONTRIBUTING.md for details on both writing and building the docs.