torch_geometric.nn.pool.approx_knn
- approx_knn(x: Tensor, y: Tensor, k: int, batch_x: Optional[Tensor] = None, batch_y: Optional[Tensor] = None) Tensor[source]
为
y中的每个元素找到x中的k个近似最近点。注意
Approximated \(k\)-nearest neighbor search is performed via the pynndescent library.
- Parameters:
x (torch.Tensor) – Node feature matrix \(\mathbf{X} \in \mathbb{R}^{N \times F}\).
y (torch.Tensor) – 节点特征矩阵 \(\mathbf{X} \in \mathbb{R}^{M \times F}\).
k (int) – The number of neighbors.
batch_x (torch.Tensor, optional) – Batch vector \(\mathbf{b} \in {\{ 0, \ldots, B-1\}}^N\), which assigns each node to a specific example. (default:
None)batch_y (torch.Tensor, optional) – Batch vector \(\mathbf{b} \in {\{ 0, \ldots, B-1\}}^M\), which assigns each node to a specific example. (default:
None)
- Return type: