File: rnn.pyi

package info (click to toggle)
pytorch 1.13.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 139,252 kB
  • sloc: cpp: 1,100,274; python: 706,454; ansic: 83,052; asm: 7,618; java: 3,273; sh: 2,841; javascript: 612; makefile: 323; xml: 269; ruby: 185; yacc: 144; objc: 68; lex: 44
file content (75 lines) | stat: -rw-r--r-- 2,282 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from collections import namedtuple
from typing import Any, List, Optional, overload, Union, TypeVar, Tuple, Sequence
from torch import Tensor
from torch.types import _dtype, _device

PackedSequence_ = namedtuple('PackedSequence_', ['data', 'batch_sizes', 'sorted_indices', 'unsorted_indices'])


def bind(optional: Any, fn: Any): ...


T = TypeVar('T')


class PackedSequence(PackedSequence_):
    def __new__(cls, data: Tensor, batch_sizes: Optional[Tensor] = ..., sorted_indices: Optional[Tensor] = ...,
                unsorted_indices: Optional[Tensor] = ...) -> PackedSequence: ...

    def pin_memory(self: T) -> T: ...

    def cuda(self: T, *args: Any, **kwargs: Any) -> T: ...

    def cpu(self: T) -> T: ...

    def double(self: T) -> T: ...

    def float(self: T) -> T: ...

    def half(self: T) -> T: ...

    def long(self: T) -> T: ...

    def int(self: T) -> T: ...

    def short(self: T) -> T: ...

    def char(self: T) -> T: ...

    def byte(self: T) -> T: ...

    @overload
    def to(self: T, dtype: _dtype, non_blocking: bool = False, copy: bool = False) -> T: ...

    @overload
    def to(self: T, device: Optional[Union[_device, str]] = None, dtype: Optional[_dtype] = None,
           non_blocking: bool = False, copy: bool = False) -> T: ...

    @overload
    def to(self, other: Tensor, non_blocking: bool = False, copy: bool = False) -> T: ...

    @property
    def is_cuda(self) -> bool: ...

    def is_pinned(self) -> bool: ...


def invert_permutation(permutation: Optional[Tensor]): ...


def pack_padded_sequence(input: Tensor, lengths: Tensor, batch_first: bool = ...,
                         enforce_sorted: bool = ...) -> PackedSequence: ...


def pad_packed_sequence(sequence: PackedSequence, batch_first: bool = ..., padding_value: float = ...,
                        total_length: Optional[int] = ...) -> Tuple[Tensor, ...]: ...


def pad_sequence(sequences: List[Tensor], batch_first: bool = False, padding_value: float = ...) -> Tensor: ...


def pack_sequence(sequences: Sequence[Tensor], enforce_sorted: bool = ...) -> PackedSequence: ...


def get_packed_sequence(data: Tensor, batch_sizes: Optional[Tensor], sorted_indices: Optional[Tensor],
                        unsorted_indices: Optional[Tensor]) -> PackedSequence: ...