File size: 3,791 Bytes
4a7e280 |
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 |
import torch.nn as nn
# class IntentClassifier(nn.Module):
# def __init__(self, input_dim, num_intent_labels, dropout_rate=0.):
# super(IntentClassifier, self).__init__()
# self.dropout = nn.Dropout(dropout_rate)
# self.linear = nn.Linear(input_dim, num_intent_labels)
# def forward(self, x):
# x = self.dropout(x)
# return self.linear(x)
class IndicatorClassifier(nn.Module):
def __init__(self, input_dim, num_indicator_labels, dropout_rate=0.):
super(IndicatorClassifier, self).__init__()
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Linear(input_dim, num_indicator_labels)
def forward(self, x):
x = self.dropout(x)
return self.linear(x)
class MetricTypeClassifier(nn.Module):
def __init__(self, input_dim, num_metric_type_labels, dropout_rate=0.):
super(MetricTypeClassifier, self).__init__()
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Linear(input_dim, num_metric_type_labels)
def forward(self, x):
x = self.dropout(x)
return self.linear(x)
class SeasonalClassifier(nn.Module):
def __init__(self, input_dim, num_seasonal_labels, dropout_rate=0.):
super(SeasonalClassifier, self).__init__()
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Linear(input_dim, num_seasonal_labels)
def forward(self, x):
x = self.dropout(x)
return self.linear(x)
class ActivityClassifier(nn.Module):
def __init__(self, input_dim, num_activity_labels, dropout_rate=0.):
super(ActivityClassifier, self).__init__()
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Linear(input_dim, num_activity_labels)
def forward(self, x):
x = self.dropout(x)
return self.linear(x)
class FrequencyClassifier(nn.Module):
def __init__(self, input_dim, num_frequency_labels, dropout_rate=0.):
super(FrequencyClassifier, self).__init__()
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Linear(input_dim, num_frequency_labels)
def forward(self, x):
x = self.dropout(x)
return self.linear(x)
class CalcModeClassifier(nn.Module):
def __init__(self, input_dim, num_calc_mode_labels, dropout_rate=0.):
super(CalcModeClassifier, self).__init__()
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Linear(input_dim, num_calc_mode_labels)
def forward(self, x):
x = self.dropout(x)
return self.linear(x)
class ReqFormClassifier(nn.Module):
def __init__(self, input_dim, num_req_form_labels, dropout_rate=0.):
super(ReqFormClassifier, self).__init__()
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Linear(input_dim, num_req_form_labels)
def forward(self, x):
x = self.dropout(x)
return self.linear(x)
# class ContextModeClassifier(nn.Module):
# def __init__(self, input_dim, num_context_mode_labels, dropout_rate=0.):
# super(ContextModeClassifier, self).__init__()
# self.dropout = nn.Dropout(dropout_rate)
# self.linear = nn.Linear(input_dim, num_context_mode_labels)
# def forward(self, x):
# x = self.dropout(x)
# return self.linear(x)
# class SlotClassifier(nn.Module):
# def __init__(self, input_dim, num_slot_labels, dropout_rate=0.):
# super(SlotClassifier, self).__init__()
# self.dropout = nn.Dropout(dropout_rate)
# self.linear = nn.Linear(input_dim, num_slot_labels)
# def forward(self, x):
# x = self.dropout(x)
# return self.linear(x) |