Skip to content

Conversation

@qindazhu
Copy link
Contributor

@qindazhu qindazhu commented Aug 6, 2018

No description provided.

// check 'n2 > index_vector.size()' first,
// otherwise, 'end - n2' will be less than 'index_vector.begin()' and
// cause error "vector iterator + offset out of range" in STL vector.
if (n2 > index_vector.size() || iter >= end - n2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make 'size' a variable (declare it next to 'ans') as it's inefficient to keep using size() in a loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated! Define 'len' as 'index_vector.size()'. Pls review again. Thanks!

@qindazhu qindazhu force-pushed the fix-bound-bug-of-nnet-common branch from b1ff84f to 1df9cc1 Compare August 7, 2018 02:32
ans += iter->x * 89809;
// check 'n2 > index_vector.size()' first,
// otherwise, 'end - n2' will be less than 'index_vector.begin()' and
// cause error "vector iterator + offset out of range" in STL vector.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure this code is correctly indented (and make sure you use spaces not tabs).
Also, you can change the comment to the following:
// The following if-statement was introduced in order to fix an
// out-of-range iterator problem on Windows.

std::vector<Index>::const_iterator iter = index_vector.begin(),
end = index_vector.end(), med = end;
if (med > iter + n1)
if (n1 <= len)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. also I believe this should be if n1 < len, not <=.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated again. Also checked indentation and spaces. With another question:

why when med == end == iter + n1, we would like to do for (; iter != med; ++iter) instead of skip this? This will make the hash better?

@qindazhu qindazhu force-pushed the fix-bound-bug-of-nnet-common branch 3 times, most recently from bf2f017 to 43eeb9a Compare August 8, 2018 02:37
@qindazhu qindazhu force-pushed the fix-bound-bug-of-nnet-common branch from 43eeb9a to 68d847d Compare August 8, 2018 02:39
@danpovey danpovey merged commit 8e97639 into kaldi-asr:master Aug 8, 2018
@qindazhu qindazhu deleted the fix-bound-bug-of-nnet-common branch August 8, 2018 04:24
xiaohui-zhang pushed a commit to xiaohui-zhang/kaldi that referenced this pull request Aug 11, 2018
xiaohui-zhang pushed a commit to xiaohui-zhang/kaldi that referenced this pull request Aug 11, 2018
…ng/limit_arpa_unk_history.py

[src] Correct usage message of acc-lda (kaldi-asr#2598)

[scripts] RNNLM script fix: to accept successive spaces in configs (etc.)  kaldi-asr#2595 (kaldi-asr#2597)

[scripts] Slight cleanup in lmrescore_rnnlm_lat.sh (kaldi-asr#2554)

[src] Fix Windows out-of-range iterator issue for nnet3 (kaldi-asr#2594)

[src] Update Windows installation instructions (kaldi-asr#2607)

[egs] Fix to LibriSpeech download script [affects 2nd run] (kaldi-asr#2611)

[src] Change RNNLM test program to clean up temporary file (kaldi-asr#2610)

added a script to scale arcs which output <unk> in HCLG.fst

fix

fix

updating results and cleaning up scripts, and fixed a bug in utils/lang/limit_arpa_unk_history.py

[scripts] Fix to script usage message (kaldi-asr#2601)

[src] Correct usage message of acc-lda (kaldi-asr#2598)

[scripts] RNNLM script fix: to accept successive spaces in configs (etc.)  kaldi-asr#2595 (kaldi-asr#2597)

[scripts] Slight cleanup in lmrescore_rnnlm_lat.sh (kaldi-asr#2554)

[src] Fix Windows out-of-range iterator issue for nnet3 (kaldi-asr#2594)

[src] Update Windows installation instructions (kaldi-asr#2607)

[egs] Fix to LibriSpeech download script [affects 2nd run] (kaldi-asr#2611)

[src] Change RNNLM test program to clean up temporary file (kaldi-asr#2610)
dpriver pushed a commit to dpriver/kaldi that referenced this pull request Sep 13, 2018
Skaiste pushed a commit to Skaiste/idlak that referenced this pull request Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants