torch_geometric.nn.pool.ApproxMIPSKNNIndex

class ApproxMIPSKNNIndex(num_cells: int, num_cells_to_visit: int, bits_per_vector: int, emb: Optional[Tensor] = None, reserve: Optional[int] = None)[source]

基础类:KNNIndex

执行快速的近似\(k\)-最近邻搜索 (\(k\)-NN),基于最大内积,通过faiss 库。 需要调整超参数以权衡速度与准确性。

Parameters:
  • num_cells (int) – 单元格的数量。

  • num_cells_to_visit (int) – 执行搜索时访问的单元格数量。

  • bits_per_vector (int) – 每个子向量的位数。

  • emb (torch.Tensor, optional) – 要添加的数据点。 (默认: None)

  • reserve (int, optional) – 在重新分配内存之前,为元素预留的内存数量(仅限GPU)。(默认值: None)