Skip to content

Commit 6edf1be

Browse files
authored
[src] Fix to nnet3-chain-get-egs corner-case bug discovered by Armando Muscarellio (kaldi-asr#2536)
1 parent ad93210 commit 6edf1be

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/chainbin/nnet3-chain-get-egs.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ static bool ProcessFile(const TransitionModel *trans_mdl,
116116
supervision_length_tolerance))
117117
return false; // LengthsMatch() will have printed a warning.
118118

119+
// It can happen if people mess with the feature frame-width options, that
120+
// there can be small mismatches in length between the supervisions (derived
121+
// from lattices) and the features; if this happens, and
122+
// supervision_length_tolerance is nonzero, and the num-input-frames is larger
123+
// than plausible for this num_output_frames, then it could lead us to try to
124+
// access frames in the supervision that don't exist. The following
125+
// if-statement is to prevent that happening.
126+
if (num_input_frames > num_output_frames * frame_subsampling_factor)
127+
num_input_frames = num_output_frames * frame_subsampling_factor;
128+
119129
std::vector<ChunkTimeInfo> chunks;
120130

121131
utt_splitter->GetChunksForUtterance(num_input_frames, &chunks);

0 commit comments

Comments
 (0)