MCPcopy
hub / github.com/Tencent/NeuralNLP-NeuralClassifier / __init__

Method __init__

model/layers.py:27–34  ·  view source on GitHub ↗
(self, input_dimension, attention_dimension, device, dropout=0)

Source from the content-addressed store, hash-verified

25 """
26
27 def __init__(self, input_dimension, attention_dimension, device, dropout=0):
28 super(SumAttention, self).__init__()
29 self.attention_matrix = \
30 torch.nn.Linear(input_dimension, attention_dimension).to(device)
31 self.attention_vector = torch.nn.Linear(attention_dimension, 1, bias=False).to(device)
32 init_tensor(self.attention_matrix.weight)
33 init_tensor(self.attention_vector.weight)
34 self.dropout = torch.nn.Dropout(p=dropout)
35
36 def forward(self, inputs):
37 if inputs.size(1) == 1:

Callers

nothing calls this directly

Calls 2

init_tensorFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected