__init__.pyi 993 Bytes
Newer Older
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
1
2
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.

Tom Birch's avatar
Tom Birch committed
3
from typing import Any, List, Union, Optional
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
4
from torch import Tensor
Tom Birch's avatar
Tom Birch committed
5
import datetime
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
6

Tom Birch's avatar
Tom Birch committed
7
8
class Backend: ...
class ProcessGroup: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
9

Tom Birch's avatar
Tom Birch committed
10
11
12
13
14
15
16
17
18
19
20
21
class ReduceOp:
    SUM: ReduceOp
    PRODUCT: ReduceOp
    MIN: ReduceOp
    MAX: ReduceOp
    BAND: ReduceOp
    BOR: ReduceOp
    BXOR: ReduceOp

def get_rank(group: Any = None) -> int: ...

def get_world_size(group: Any = None) -> int: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
22
23
24

def broadcast(tensor: Tensor, src: Any, group: Any, async_op: Any = False): ...

Tom Birch's avatar
Tom Birch committed
25
26
27
28
29
30
31
def is_initialized() -> bool: ...

def new_group(ranks: List[int], timeout: datetime.timedelta = datetime.timedelta(0, 1800), backend: Union[None, str, Backend] = None): ...

def all_reduce(tensor: Tensor, op: ReduceOp = ReduceOp.SUM, group:Optional[ProcessGroup] = None, async_op: bool = False): ...
def all_gather(tensor_list: List[Tensor], tensor: Tensor, group:Optional[ProcessGroup] = None, async_op: bool = False): ...

Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
32
33
class group(object):
    WORLD: Any