-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainers.py
81 lines (61 loc) · 1.44 KB
/
containers.py
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
from typing import List
from torch import Tensor
from typing import Optional
from dataclasses import dataclass
@dataclass
class Hyperparameters:
batch_size: int
hidden_size: int
num_layers: int
dropout: float
scheduler_gamma: float
@dataclass
class Batch:
source: Tensor
source_length: Tensor
target: Optional[Tensor] = None
target_length: Optional[Tensor] = None
@dataclass
class EncoderOutput:
source_embeddings: Tensor
source_encodings: Tensor
@dataclass
class DecoderOutput:
contexts: Tensor
seq2seq_contexts: Tensor
hidden_state: Tensor
source_selection: Tensor
decoder_outputs: Tensor
decoder_states: Tensor
decoder_state_selection: Tensor
target_embedded: Tensor
@dataclass
class BridgeOutput:
output: Tensor
feature_scores: Tensor
@dataclass
class AttentionOutput:
contexts: Tensor
attention_scores: Tensor
hard_attention_scores: Tensor
@dataclass
class MaskContainer:
source_mask: Tensor
target_mask: Tensor
attention_mask: Tensor
@dataclass
class AdditionalInferenceInformation:
alignment: Tensor
sequence_features: Tensor
symbol_features: Tensor
decoder_states: Tensor
@dataclass
class InferenceOutput:
source: List[int]
prediction: List[int]
additional_information: AdditionalInferenceInformation
@dataclass
class Metrics:
correct: bool
edit_distance: float
normalised_edit_distance: float