Clang-format _distributed_c10d.pyi (#55220)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55220
ghstack-source-id: 125597170
Test Plan: N/A
Reviewed By: pritamdamania87
Differential Revision: D27531346
fbshipit-source-id: c603cadbff682a9361d0e97d164f18b029e396b1
diff --git a/torch/_C/_distributed_c10d.pyi b/torch/_C/_distributed_c10d.pyi
index a0ffbd3..95f00bb 100644
--- a/torch/_C/_distributed_c10d.pyi
+++ b/torch/_C/_distributed_c10d.pyi
@@ -1,7 +1,8 @@
-from torch import Tensor
+from datetime import timedelta
from enum import Enum
from typing import Optional, List, Any, overload
-from datetime import timedelta
+
+from torch import Tensor
# This module is defined in torch/csrc/distributed/c10d/init.cpp
@@ -13,7 +14,9 @@
FP16_COMPRESS = ...
def _register_comm_hook(reducer: Reducer, state: Any, comm_hook: Any): ...
-def _register_builtin_comm_hook(reducer: Reducer, comm_hook_type: BuiltinCommHookType): ...
+def _register_builtin_comm_hook(
+ reducer: Reducer, comm_hook_type: BuiltinCommHookType
+): ...
class GradBucket:
def __init__(self, tensors: List[Tensor]): ...
@@ -38,10 +41,7 @@
...
class Logger:
- def __init__(
- self,
- reducer: Reducer
- ): ...
+ def __init__(self, reducer: Reducer): ...
def set_construction_data_and_log(
self,
module_name: str,
@@ -77,8 +77,7 @@
reduceOp: ReduceOp
timeout: timedelta
-class AllreduceCoalescedOptions(AllreduceOptions):
- ...
+class AllreduceCoalescedOptions(AllreduceOptions): ...
class ReduceOptions:
reduceOp: ReduceOp
@@ -121,11 +120,7 @@
def wait(self, keys: List[str], timeout: timedelta): ...
class FileStore(Store):
- def __init__(
- self,
- path: str,
- numWorkers: int
- ): ...
+ def __init__(self, path: str, numWorkers: int): ...
class HashStore(Store):
def __init__(self): ...
@@ -141,11 +136,7 @@
): ...
class PrefixStore(Store):
- def __init__(
- self,
- prefix: str,
- store: Store
- ): ...
+ def __init__(self, prefix: str, store: Store): ...
class Work:
def is_completed(self) -> bool: ...
@@ -167,7 +158,7 @@
def broadcast(
self,
tensors: List[Tensor],
- opts = BroadcastOptions(),
+ opts=BroadcastOptions(),
) -> Work: ...
@overload
def broadcast(
@@ -180,43 +171,43 @@
self,
tensors: List[Tensor],
opts: AllreduceOptions = AllreduceOptions(),
- ) -> Work: ...
+ ) -> Work: ...
@overload
def allreduce(
self,
tensors: List[Tensor],
- op = ReduceOp.SUM,
+ op=ReduceOp.SUM,
) -> Work: ...
@overload
def allreduce(
self,
tensor: Tensor,
- op = ReduceOp.SUM,
+ op=ReduceOp.SUM,
) -> Work: ...
def allreduce_coalesced(
self,
tensors: List[Tensor],
- opts = AllreduceCoalescedOptions(),
+ opts=AllreduceCoalescedOptions(),
) -> Work: ...
@overload
def reduce(
self,
tensors: List[Tensor],
- opts = ReduceOptions(),
+ opts=ReduceOptions(),
) -> Work: ...
@overload
def reduce(
self,
tensor: Tensor,
root: int,
- op = ReduceOp.SUM,
+ op=ReduceOp.SUM,
) -> Work: ...
@overload
def allgather(
self,
output_tensors: List[List[Tensor]],
input_tensors: List[Tensor],
- opts = AllGatherOptions(),
+ opts=AllGatherOptions(),
) -> Work: ...
@overload
def allgather(
@@ -228,14 +219,14 @@
self,
output_lists: List[List[Tensor]],
input_list: List[Tensor],
- opts = AllGatherOptions(),
+ opts=AllGatherOptions(),
) -> Work: ...
@overload
def gather(
self,
output_tensors: List[List[Tensor]],
input_tensors: List[Tensor],
- opts = GatherOptions(),
+ opts=GatherOptions(),
) -> Work: ...
@overload
def gather(
@@ -249,7 +240,7 @@
self,
output_tensors: List[Tensor],
input_tensors: List[List[Tensor]],
- opts = ScatterOptions(),
+ opts=ScatterOptions(),
) -> Work: ...
@overload
def scatter(
@@ -263,7 +254,7 @@
self,
output_tensors: List[Tensor],
input_tensors: List[List[Tensor]],
- opts = ReduceScatterOptions(),
+ opts=ReduceScatterOptions(),
) -> Work: ...
@overload
def reduce_scatter(
@@ -278,7 +269,7 @@
input_tensor: Tensor,
output_split_sizes: List[int],
input_split_sizes: List[int],
- opts = AllToAllOptions(),
+ opts=AllToAllOptions(),
) -> Work: ...
@overload
def alltoall_base(
@@ -293,7 +284,7 @@
self,
output_tensor: List[Tensor],
input_tensor: List[Tensor],
- opts = AllToAllOptions(),
+ opts=AllToAllOptions(),
) -> Work: ...
@overload
def alltoall(
@@ -313,22 +304,15 @@
srcRank: int,
tag: int,
) -> Work: ...
- def recv_anysource(
- self,
- tensors: List[Tensor],
- tag: int
- ) -> Work: ...
- def barrier(
- self,
- opts = BarrierOptions()
- ) -> Work: ...
+ def recv_anysource(self, tensors: List[Tensor], tag: int) -> Work: ...
+ def barrier(self, opts=BarrierOptions()) -> Work: ...
class ProcessGroupRoundRobin(ProcessGroup): ...
+
def _round_robin_process_groups(
process_groups: List[ProcessGroup],
) -> ProcessGroupRoundRobin: ...
-
class ProcessGroupGloo(ProcessGroup):
class Device: ...
class Options: ...
@@ -340,7 +324,7 @@
timeout: timedelta,
): ...
@staticmethod
- def create_device(hostname = str(), interface = str()) -> Device: ...
+ def create_device(hostname=str(), interface=str()) -> Device: ...
...
@staticmethod
def create_default_device() -> Device: ...
@@ -375,7 +359,8 @@
tensors: List[Tensor],
bucket_size: int,
expect_sparse_gradient: List[bool],
- tensor_indices: List[int]) -> List[List[int]]: ...
+ tensor_indices: List[int],
+) -> List[List[int]]: ...
def _broadcast_coalesced(
process_group: ProcessGroup,
tensors: List[Tensor],
@@ -383,13 +368,9 @@
src: int,
): ...
def _test_python_store(store: Store): ...
-
def _verify_replicas_within_process(
- replicas: List[List[Tensor]],
- expect_sparse_gradient: List[List[bool]]
+ replicas: List[List[Tensor]], expect_sparse_gradient: List[List[bool]]
): ...
-
def _verify_model_across_ranks(
- process_group: ProcessGroup,
- replicas: List[List[Tensor]]
+ process_group: ProcessGroup, replicas: List[List[Tensor]]
): ...