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
So many bugs,please give up coding! I almost fixed the code here and there
The text was updated successfully, but these errors were encountered:
How about giving up ranting and starting to think what's README for? 😃
Sorry, something went wrong.
ok i apologize for that ,and i wanna sugest you use following code instead of yours , It will spped up at least 5 times than yours
def pack_for_rnn_seq(self,inputs, lengths): """ :param inputs: [T * B * D] :param lengths: [B] :return: """ _, sorted_index = lengths.sort(descending = True) ''' Reverse to decreasing order ''' s_inputs = inputs.permute(1,0,2)[sorted_index].permute(1,0,2) lengths_list = [] reverse_indices = [0] * lengths.size(0) for j, i in enumerate(sorted_index): lengths_list.append(lengths[i].item()) reverse_indices[i] = j packed_seq = pack_padded_sequence(s_inputs,lengths_list) return packed_seq, reverse_indices def unpack_from_rnn_seq(self,packed_seq, reverse_indices,max_len): unpacked_seq, _ = pad_packed_sequence(packed_seq,total_length=max_len) s_inputs_list = [] return unpacked_seq.permute(1,0,2)[reverse_indices].permute(1,0,2)
No branches or pull requests
So many bugs,please give up coding! I almost fixed the code here and there
The text was updated successfully, but these errors were encountered: