typing inductor and placeholder backends (#160366)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/160366
Approved by: https://github.com/Skylion007
ghstack dependencies: #160362, #160363, #160364, #160365
This commit is contained in:
Lucas Kabela 2025-08-13 15:40:10 -07:00 committed by PyTorch MergeBot
parent 453cfa5153
commit 05b9b63fb6
3 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,3 @@
# mypy: ignore-errors
"""
This module provides the TorchInductor backend integration for TorchDynamo.
@ -12,12 +10,14 @@ The inductor backend can be used with torch.compile():
model = torch.compile(model, backend="inductor")
"""
from typing import Any
from torch._dynamo import register_backend
from torch._dynamo.utils import dynamo_timed
@register_backend
def inductor(*args, **kwargs):
def inductor(*args: Any, **kwargs: Any) -> Any:
with dynamo_timed("inductor_import", log_pt2_compile_event=True):
# do import here to avoid loading inductor into memory when it is not used
# The AsyncCompile subproc pool can be slow to start, so warm it up as early

View File

@ -1,5 +1,3 @@
# mypy: ignore-errors
# This backend is maintained by ONNX team. To direct issues
# to the right people, please tag related GitHub issues with `module: onnx`.
#

View File

@ -1,5 +1,3 @@
# mypy: ignore-errors
# import torch # type: ignore[import]
# from .common import device_from_inputs, fake_tensor_unsupported # type: ignore[import]
# from .registry import register_backend # type: ignore[import]