We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sr/ss/model.py
def forward(self, left, right): left_vec = self.embedding(left.to(DEVICE)).to(DEVICE) # left_vec = pack_padded_sequence(left_vec, left_sent_lengths) right_vec = self.embedding(right.to(DEVICE)).to(DEVICE) # right_vec = pack_padded_sequence(right_vec, right_sent_lengths) self.hidden = self.init_hidden(batch_size=left.size(1)) left_lstm_out, (left_lstm_hidden, _) = self.lstm(left_vec, self.hidden) # left_lstm_out, left_batch_size = pad_packed_sequence(left_lstm_out) # assert torch.equal(left_sent_lengths, left_batch_size.to(DEVICE)) right_lstm_out, (right_lstm_hidden, _) = self.lstm(right_vec, self.hidden) # right_lstm_out, right_batch_size = pad_packed_sequence(right_lstm_out) # assert torch.equal(right_sent_lengths, right_batch_size.to(DEVICE)) return self.manhattan_distance(left_lstm_hidden[0], right_lstm_hidden[0])
最后一行计算曼哈顿距离 self.manhattan_distance(left_lstm_hidden[0], right_lstm_hidden[0]), 用的是第一层的隐藏状态,是不是有问题?
self.manhattan_distance(left_lstm_hidden[0], right_lstm_hidden[0])
The text was updated successfully, but these errors were encountered:
No branches or pull requests
sr/ss/model.py
最后一行计算曼哈顿距离
self.manhattan_distance(left_lstm_hidden[0], right_lstm_hidden[0])
, 用的是第一层的隐藏状态,是不是有问题?The text was updated successfully, but these errors were encountered: