AscendIndexIVFSQT

API definition

AscendIndexIVFSQT(const faiss::IndexIVFScalarQuantizer *index, AscendIndexIVFSQTConfig config = AscendIndexIVFSQTConfig());

Function

Constructor of AscendIndexIVFSQT, which is used to create a retrieval index on the Ascend based on an existing index.

Input

const faiss::IndexIVFScalarQuantizer* index: index resources on the CPU.

AscendIndexIVFSQTConfig config: resource configuration on the device.

Output

N/A

Return value

N/A

Restrictions

  • index must be a valid CPU Index pointer.
  • index->d ∈ {256}
  • index->sq.d ∈ {32, 64, 128}
  • The dimension of index must be greater than that of index->sq and can be divided by index->sq.

API definition

AscendIndexIVFSQT(int dimIn, int dimOut, int nlist, faiss::ScalarQuantizer::QuantizerType qtype = ScalarQuantizer::QuantizerType::QT_8bit, faiss::MetricType metric = MetricType::METRIC_INNER_PRODUCT, AscendIndexIVFSQTConfig config = AscendIndexIVFSQTConfig());

Function

Constructor of AscendIndexIVFSQT, which generates AscendIndexIVFSQT. The device resources are set based on the value configured in config.

Input

int dimIn: dimensions of a group of original feature vectors managed by AscendIndexIVFSQT.

int dimOut: dimensions of a group of dimension-reduced feature vectors managed by AscendIndexIVFSQT.

int nlist: number of cluster centroids, which corresponds to coarse_centroid_num in the operator generation script.

faiss::ScalarQuantizer::QuantizerType qtype: quantizer type of AscendIndexIVFSQT.

faiss::MetricType metric: distance measurement type used by AscendIndex when it retrieves feature vector similarity.

AscendIndexIVFSQTConfig config: resource configuration on the device.

Output

N/A

Return value

N/A

Restrictions

  • dimIn ∈ {256}
  • dimOut ∈ {32, 64, 128}
  • nlist ∈ {1024, 2048, 4096, 8192, 16384, 32768}
  • qtype = ScalarQuantizer::QuantizerType::QT_8bit: Currently, only ScalarQuantizer::QuantizerType::QT_8bit is supported.
  • metric = faiss::MetricType::METRIC_INNER_PRODUCT: Currently, only faiss::MetricType::METRIC_INNER_PRODUCT is supported.

API definition

AscendIndexIVFSQT(const AscendIndexIVFSQT&) = delete;

Function

Declares that the copy constructor of this Index class is void, that is, it cannot be copied.

Input

const AscendIndexIVFSQT&: AscendIndexIVFSQT object.

Output

N/A

Return value

N/A

Restrictions

N/A