xidulu commented on issue #19073: URL: https://github.com/apache/incubator-mxnet/issues/19073#issuecomment-723400122
@sxjscience The implementation of the binary search is correct. The problem behind is that the binary search would return the index of the first element larger or equal to `value`. When no such element is found, i.e. `value` is larger than all elements in [0, K), index K will be returned, which is invalid. In such case, one should add a special check after the loop, just like the origin version of multinomial: https://sourcegraph.com/github.com/apache/incubator-mxnet/-/commit/e6fad30e45e6ec0ddef5c18093e8163cd2a7c62c#diff-dfa5ed462be234eb86a84d01466756cfL140 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
