AscendIndexCodeBookInitParams

API definition

AscendIndexCodeBookInitParams(int numIter, int device, float ratio, int batchSize, int codeNum, std::string codeBookOutputDir, std::string learnDataPath, bool verbose);

Function

Initialization structure of the IVFSP training codebook.

Input

N/A

Output

N/A

Value

int numIter: number of training iterations. The default value is 1.

int device: logical device ID. The default value is 0.

float ratio: sampling rate of original samples used for training. The default value is 1.0.

int batchSize: batch size used for training. The value of this parameter must be the same as that of <batch_size> for generating the IVFSP training operator model file in IVFSP. The default value is 32768.

int codeNum: maximum number of codebooks to be operated. The value must be a power of 2. The value of this parameter must be the same as that of <codebook_batch_size> for generating the IVFSP training operator model file in IVFSP. The default value is 32768.

std::string codeBookOutputDir: directory to which the generated codebook file is exported. Ensure that this directory exists and the user who executes the program has the write permission on this directory. For security hardening, this directory level cannot contain soft links.

std::string learnDataPath: path of the original feature file used for training. The bin and npy formats are supported. The bin storage mode is row-major. The data type is float32.

bool verbose: whether to print extra information. The default value is true.

Restrictions

  • numIter ∈ (0, 20]
  • ratio ∈ (0, 1.0]
  • batchSize ∈ (0, 32768]
  • codeNum ∈ (0, 32768]
  • When a codebook file exists, it will be overwritten. In this case, the program running user should be the owner of the file.
  • Before executing the generated training codebook, generate a training operator model file by referring to IVFSP.