def forward(self, input):
weights = self.weight.view(self.inp, self.outp * self.kw) # weights applied to all
bias = self.bias
nOutputFrame = int((input.size(0) - self.kw) / self.dw + 1)
output = Variable(torch.FloatTensor(nOutputFrame, self.outp))
for i in range(input.size(0)): # do -- for each sequence element
element = input[i] # ; -- features of ith sequence element
output[i] = torch.dot(element, weights) + bias
return output
评论列表
文章目录