Fix access violation exception that can occur during invocation of loop lambda...
Fix access violation exception that can occur during invocation of loop lambda function when inner_start >= inner_end in 'For' template (#3936)
* Fix index out-of-range exception generated by BaggingHelper on small datasets.
Prior to this change, the line "score_t threshold = tmp_gradients[top_k - 1];" would generate an exception, since tmp_gradients would be empty when the cnt input value to the function is zero.
* Update goss.hpp
* Update goss.hpp
* Add API method LGBM_BoosterPredictForMats which runs prediction on a data set given as of array of pointers to rows (as opposed to existing method LGBM_BoosterPredictForMat which requires data given as contiguous array)
* Fix incorrect upstream merge
* Add link to LightGBM.NET
* Fix indenting to 2 spaces
* Dummy edit to trigger CI
* Dummy edit to trigger CI
* remove duplicate functions from merge
* Fix access violation exception that can occur during invocation of loop lambda function when inner_start >= inner_end in 'For' template.
In particular, this can occur in Tree::AddPredictionToScore on line 291 where the loop lambda function body (created by the PredictionFun macro) dereferences used_data_indices[start].
For reference, the particular case which triggered this exception in my case was:
* start = 0
* end = 93,203
* n_block = 56
* min_block_size = 512
for which the BlockInfo method gave:
* n_block = 56
* num_inner = 1,696
and so, for the case i=55 (i.e., the last case in the loop), we get
* inner_start = start + num_inner * i
= 93,280
which is greater than 'end' and hence triggers the exception.
* Change formatting of proposed modification
Co-authored-by:
matthew-peacock <matthew.peacock@whiteoakam.com>
Co-authored-by:
Guolin Ke <guolin.ke@outlook.com>
Showing
Please register or sign in to comment