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

3
import torch
Tom Birch's avatar
Tom Birch committed
4
from typing import Optional, Tuple, Union, Dict, Any
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
5
import ctypes
6
from . import amp
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
7
8
9
10
from .. import device as _device

def is_available() -> bool: ...
def init() -> None: ...
Tom Birch's avatar
Tom Birch committed
11
def _lazy_call(callable) -> None: ...
12
def _sleep(_:int) -> None : ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

class cudaStatus:
    SUCCESS: int
    ERROR_NOT_READY: int

class CudaError:
    def __init__(self, code: int) -> None: ...

class _CudaDeviceProperties:
    name: str
    major: int
    minor: int
    multi_processor_count: int
    total_memory: int
    is_integrated: int
    is_multi_gpu_board: int

Tom Birch's avatar
Tom Birch committed
30
_device_t = Union[_device, int, str]
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
31
32
33
34

def check_error(res: int) -> None: ...
def device_count() -> int: ...
def empty_cache() -> None: ...
35
def synchronize(device: Optional[_device_t]=None) -> None: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
36
37
38
39
40
def set_device(device: _device_t) -> None: ...
def get_device_capability(device: Optional[_device_t]=...) -> Tuple[int, int]: ...
def get_device_name(device: Optional[_device_t]=...) -> str: ...
def get_device_properties(device: _device_t) -> _CudaDeviceProperties: ...
def current_device() -> int: ...
Tom Birch's avatar
Tom Birch committed
41
def manual_seed(seed: int) -> None: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
42
43
44
def memory_allocated(device: Optional[_device_t]=...) -> int: ...
def max_memory_allocated(device: Optional[_device_t]=...) -> int: ...
def reset_max_memory_allocated(device: Optional[_device_t]=...) -> None: ...
45
def reset_peak_memory_stats(device: Union[_device_t, int] = None) -> None: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
46
47
48
def memory_cached(device: Optional[_device_t]=...) -> int: ...
def max_memory_cached(device: Optional[_device_t]=...) -> int: ...
def reset_max_memory_cached(device: Optional[_device_t]=...) -> None: ...
49
def memory_summary() -> str: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
50
51
def cudart() -> ctypes.CDLL: ...
def find_cuda_windows_lib() -> Optional[ctypes.CDLL]: ...
52
def list_gpu_processes(device: Union[torch.device, str, None, int] = None) -> str: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#MODIFIED BY TORCHGPIPE
from .. import ByteTensor
def set_rng_state(new_state: ByteTensor, device: _device_t = ...) -> None: ...
def get_rng_state(device: _device_t = ...) -> ByteTensor: ...
#END

#MODIFIED BY TORCHGPIPE
from typing import Any
class device:
    def __init__(self, device: _device_t = ...) -> None: ...
    def __enter__(self) -> None: ...
    def __exit__(self, *args: Any) -> None: ...

class Stream:
    device: _device
    def __init__(self, device: _device_t = ..., priority: int = ...) -> None: ...
    def synchronize(self) -> None: ...
    def wait_stream(self, stream: Stream) -> None: ...

72
73
74
75
76
77
class Event:
    def __new__(cls, enable_timing: bool = False, blocking:bool = False, interprocess: bool = False) -> "Event": ...
    def record(self, stream: Optional[Stream] = None) -> None: ...
    def synchronize(self) -> None: ...
    def elapsed_time(self, end_event: Event) -> int: ...

Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
78
79
80
81
82
class stream:
    def __init__(self, stream: Optional[Stream] = ...) -> None: ...
    def __enter__(self) -> None: ...
    def __exit__(self, *args: Any) -> None: ...

Tom Birch's avatar
Tom Birch committed
83
84
def current_stream(device: Optional[_device_t] = None) -> Stream: ...
def default_stream(device: Optional[_device_t] = None) -> Stream: ...
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
85
#END
Tom Birch's avatar
Tom Birch committed
86
87
#
default_generators: Tuple[Any]