mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
------ - [Generic TypeAlias (PEP 585)](https://peps.python.org/pep-0585): e.g. `typing.List[T] -> list[T]`, `typing.Dict[KT, VT] -> dict[KT, VT]`, `typing.Type[T] -> type[T]`. - [Union Type (PEP 604)](https://peps.python.org/pep-0604): e.g. `Union[X, Y] -> X | Y`, `Optional[X] -> X | None`, `Optional[Union[X, Y]] -> X | Y | None`. Note that in `.pyi` stub files, we do not need `from __future__ import annotations`. So this PR does not violate issue #117449: - #117449 Pull Request resolved: https://github.com/pytorch/pytorch/pull/129419 Approved by: https://github.com/ezyang ghstack dependencies: #129375, #129376
33 lines
1017 B
Python
33 lines
1017 B
Python
import torch
|
|
from torch._C._distributed_c10d import Store
|
|
from torch._C._distributed_rpc import _TensorPipeRpcBackendOptionsBase, TensorPipeAgent
|
|
|
|
# This module is defined in torch/csrc/distributed/rpc/testing/init.cpp
|
|
|
|
class FaultyTensorPipeRpcBackendOptions(_TensorPipeRpcBackendOptionsBase):
|
|
def __init__(
|
|
self,
|
|
num_worker_threads: int,
|
|
rpc_timeout: float,
|
|
init_method: str,
|
|
messages_to_fail: list[str],
|
|
messages_to_delay: dict[str, float],
|
|
num_fail_sends: int,
|
|
) -> None: ...
|
|
num_send_recv_threads: int
|
|
messages_to_fail: list[str]
|
|
messages_to_delay: dict[str, float]
|
|
num_fail_sends: int
|
|
|
|
class FaultyTensorPipeAgent(TensorPipeAgent):
|
|
def __init__(
|
|
self,
|
|
store: Store,
|
|
name: str,
|
|
rank: int,
|
|
world_size: int,
|
|
options: FaultyTensorPipeRpcBackendOptions,
|
|
reverse_device_maps: dict[str, dict[torch.device, torch.device]],
|
|
devices: list[torch.device],
|
|
) -> None: ...
|