Description of changes:
Fix train/predict bugs in PairwiseANN:
(1) For training, deep copy the X_trn and Y_csc matrix, to prevent pX/pY being modified and deleted at Python level. Otherwise, the PairwiseANN index may save the wrong content, or facing sagmentation fault.
(2) For inference, searchers take in the pred_params, which pre-allocate the memory of return numpy array. We do not accept different topk at PairwiseANN.predict(), as it cause complexity to slice the returned matrix back.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available:
Description of changes: Fix train/predict bugs in PairwiseANN: (1) For training, deep copy the
X_trn
andY_csc
matrix, to prevent pX/pY being modified and deleted at Python level. Otherwise, the PairwiseANN index may save the wrong content, or facing sagmentation fault. (2) For inference, searchers take in thepred_params
, which pre-allocate the memory of return numpy array. We do not accept differenttopk
at PairwiseANN.predict(), as it cause complexity to slice the returned matrix back.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.