__init__.pyi 1.54 KB
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
from . import rpc as rpc

Tom Birch's avatar
Tom Birch committed
9
class Backend: ...
Tom Birch's avatar
Tom Birch committed
10
11
12
13

class ProcessGroup:
    def size(self) -> int: ...
    def rank(self) -> int: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
14

Tom Birch's avatar
Tom Birch committed
15
16
17
18
19
20
21
22
23
24
25
26
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
27
28
29

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

Tom Birch's avatar
Tom Birch committed
30
31
32
33
34
35
36
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): ...

Tom Birch's avatar
Tom Birch committed
37
38
39
40
41
def send(tensor: Tensor, dst: int, group: Optional[ProcessGroup] = None, tag: Optional[int] = None) -> None: ...
def isend(tensor: Tensor, dst: int, group: Optional[ProcessGroup] = None, tag: Optional[int] = None) -> None: ...
def recv(tensor: Tensor, src: Optional[int] = None, group: Optional[ProcessGroup] = None, tag: Optional[int] = None) -> int: ...
def irecv(tensor: Tensor, src: Optional[int] = None, group: Optional[ProcessGroup] = None, tag: Optional[int] = None) -> int: ...

Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
42
43
class group(object):
    WORLD: Any
Tom Birch's avatar
Tom Birch committed
44
45

class RRef: ...