train

API definition

void train(idx_t n, const float *x) override;

Function

Trains the quantizer of AscendIndexSQ. It inherits the APIs in AscendFaiss and provides specific implementation. You must train the index before using the add method.

Input

idx_t n: number of feature vectors in the training dataset.

const float *x: feature vector data.

Output

N/A

Return value

N/A

Restrictions

  • Range of n: 0 < n < 1e9.
  • x must be a non-null pointer with a length of dims × n. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown.
  • Data distribution is collected during training. If the training dataset is small, the query accuracy may be affected.