"vscode:/vscode.git/clone" did not exist on "b903344200c7e0adf5c97288b37c53627a7dd065"
loss.pyi 6.33 KB
Newer Older
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.

from typing import Any, Optional
from .module import Module
from ... import Tensor


# The deprecated `size_average` and `reduce` arguments are not included in the stubs
class _Loss(Module):
    reduction: str = ...

    def __init__(self, reduction: str = ...) -> None: ...


class _WeightedLoss(_Loss):
    def __init__(self, weight: Optional[Any] = ..., reduction: str = ...) -> None: ...


class L1Loss(_Loss):
    def __init__(self, reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class NLLLoss(_WeightedLoss):
    ignore_index: int = ...

    def __init__(self, weight: Optional[Any] = ..., ignore_index: int = ..., reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class NLLLoss2d(NLLLoss):
    def __init__(self, weight: Optional[Any] = ..., ignore_index: int = ..., reduction: str = ...) -> None: ...


class PoissonNLLLoss(_Loss):
    log_input: bool = ...
    full: bool = ...
    eps: float = ...

    def __init__(self, log_input: bool = ..., full: bool = ..., eps: float = ..., reduction: str = ...) -> None: ...

    def forward(self, log_input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, log_input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class KLDivLoss(_Loss):
    def __init__(self, reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class MSELoss(_Loss):
    def __init__(self, reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class BCELoss(_WeightedLoss):
    def __init__(self, weight: Optional[Any] = ..., reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class BCEWithLogitsLoss(_Loss):
    def __init__(self, weight: Optional[Any] = ..., reduction: str = ..., pos_weight: Optional[Any] = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class HingeEmbeddingLoss(_Loss):
    margin: Any = ...

    def __init__(self, margin: float = ..., reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class MultiLabelMarginLoss(_Loss):
    def __init__(self, reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class SmoothL1Loss(_Loss):
    def __init__(self, reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class SoftMarginLoss(_Loss):
    def __init__(self, reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class CrossEntropyLoss(_WeightedLoss):
    ignore_index: int = ...

    def __init__(self, weight: Optional[Any] = ..., ignore_index: int = ..., reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class MultiLabelSoftMarginLoss(_WeightedLoss):
    def __init__(self, weight: Optional[Any] = ..., reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class CosineEmbeddingLoss(_Loss):
    margin: float = ...

    def __init__(self, margin: float = ..., reduction: str = ...) -> None: ...

    def forward(self, input1: Tensor, input2: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input1: Tensor, input2: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class MarginRankingLoss(_Loss):
    margin: float = ...

    def __init__(self, margin: float = ..., reduction: str = ...) -> None: ...

    def forward(self, input1: Tensor, input2: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input1: Tensor, input2: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class MultiMarginLoss(_WeightedLoss):
    p: int = ...
    margin: float = ...

    def __init__(self, p: int = ..., margin: float = ..., weight: Optional[Any] = ...,
                 reduction: str = ...) -> None: ...

    def forward(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, input: Tensor, target: Tensor) -> Tensor: ...  # type: ignore


class TripletMarginLoss(_Loss):
    margin: float = ...
    p: int = ...
    eps: float = ...
    swap: bool = ...

    def __init__(self, margin: float = ..., p: int = ..., eps: float = ..., swap: bool = ...,
                 reduction: str = ...) -> None: ...

    def forward(self, anchor: Tensor, positive: Tensor, negative: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, anchor: Tensor, positive: Tensor, negative: Tensor) -> Tensor: ...  # type: ignore


class CTCLoss(_Loss):
    blank: int = ...
    zero_infinity: bool = ...

    def __init__(self, blank: int = ..., reduction: str = ..., zero_infinity: bool = ...) -> None: ...

    def forward(self, log_probs: Tensor, targets: Tensor, input_lengths: Tensor, target_lengths: Tensor) -> Tensor: ...  # type: ignore

    def __call__(self, log_probs: Tensor, targets: Tensor, input_lengths: Tensor, target_lengths: Tensor) -> Tensor: ...  # type: ignore