Fix some bugs of empty inputs #794
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We met serveral crashes when decoding with single wav, as post in k2-fsa/snowfall#239. I thought these crashes are all about empty inputs.
@luomingshuang 's issue locating in the
k2.index_selectfunction, occurs when the inputindexesis an empty tensor, see the comments in source code for details.@alucassch 's issue occuring in thenbest_decoding, is a bug in thek2.ragged.arg_max_persublist,. The function return[-1]with the empty input, which causes a strange behavior in the following code.Update: I made a mistake, the return value of
arg_max_persublistis expected, this was also a bug ink2.index(src, index). Ifsrcis an empty tensor,k2.indexshould return an empty tensor, in current implementation,k2.index([], [-1])would return[0].