[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-rusty1s--pytorch_cluster":3,"tool-rusty1s--pytorch_cluster":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",155373,2,"2026-04-14T11:34:08",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":77,"owner_email":78,"owner_twitter":72,"owner_website":79,"owner_url":80,"languages":81,"stars":101,"forks":102,"last_commit_at":103,"license":104,"difficulty_score":32,"env_os":105,"env_gpu":106,"env_ram":107,"env_deps":108,"category_tags":113,"github_topics":114,"view_count":32,"oss_zip_url":119,"oss_zip_packed_at":119,"status":17,"created_at":120,"updated_at":121,"faqs":122,"releases":152},7534,"rusty1s\u002Fpytorch_cluster","pytorch_cluster","PyTorch Extension Library of Optimized Graph Cluster Algorithms","pytorch_cluster 是一个专为 PyTorch 打造的高性能图聚类算法扩展库。在图神经网络和点云处理研究中，开发者常需对节点进行高效分组、采样或构建邻接关系，而原生 PyTorch 缺乏针对这些特定图操作的高度优化实现，导致计算效率受限。pytorch_cluster 正是为了解决这一痛点而生，它提供了包括 Graclus 多级别图切割、体素网格池化、迭代最远点采样（FPS）、k-近邻图生成以及随机游走采样等多种核心算法。\n\n该工具的独特亮点在于其底层代码经过深度优化，不仅支持多种数据类型，还完美兼容 CPU 与 GPU 加速，能显著提升大规模图数据的处理速度。无论是需要复现前沿论文模型的科研人员，还是致力于开发高效图学习应用的算法工程师，pytorch_cluster 都是不可或缺的得力助手。它让复杂的图结构操作变得简单快捷，帮助用户将更多精力集中在模型创新而非底层算子实现上。","[pypi-image]: https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Ftorch-cluster.svg\n[pypi-url]: https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Ftorch-cluster\n[testing-image]: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Factions\u002Fworkflows\u002Ftesting.yml\u002Fbadge.svg\n[testing-url]: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Factions\u002Fworkflows\u002Ftesting.yml\n[linting-image]: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Factions\u002Fworkflows\u002Flinting.yml\u002Fbadge.svg\n[linting-url]: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Factions\u002Fworkflows\u002Flinting.yml\n[coverage-image]: https:\u002F\u002Fcodecov.io\u002Fgh\u002Frusty1s\u002Fpytorch_cluster\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg\n[coverage-url]: https:\u002F\u002Fcodecov.io\u002Fgithub\u002Frusty1s\u002Fpytorch_cluster?branch=master\n\n# PyTorch Cluster\n\n[![PyPI Version][pypi-image]][pypi-url]\n[![Testing Status][testing-image]][testing-url]\n[![Linting Status][linting-image]][linting-url]\n[![Code Coverage][coverage-image]][coverage-url]\n\n--------------------------------------------------------------------------------\n\nThis package consists of a small extension library of highly optimized graph cluster algorithms for the use in [PyTorch](http:\u002F\u002Fpytorch.org\u002F).\nThe package consists of the following clustering algorithms:\n\n* **[Graclus](#graclus)** from Dhillon *et al.*: [Weighted Graph Cuts without Eigenvectors: A Multilevel Approach](http:\u002F\u002Fwww.cs.utexas.edu\u002Fusers\u002Finderjit\u002Fpublic_papers\u002Fmultilevel_pami.pdf) (PAMI 2007)\n* **[Voxel Grid Pooling](#voxelgrid)** from, *e.g.*, Simonovsky and Komodakis: [Dynamic Edge-Conditioned Filters in Convolutional Neural Networks on Graphs](https:\u002F\u002Farxiv.org\u002Fabs\u002F1704.02901) (CVPR 2017)\n* **[Iterative Farthest Point Sampling](#farthestpointsampling)** from, *e.g.* Qi *et al.*: [PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space](https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.02413) (NIPS 2017)\n* **[k-NN](#knn-graph)** and **[Radius](#radius-graph)** graph generation\n* Clustering based on **[Nearest](#nearest)** points\n* **[Random Walk Sampling](#randomwalk-sampling)** from, *e.g.*, Grover and Leskovec: [node2vec: Scalable Feature Learning for Networks](https:\u002F\u002Farxiv.org\u002Fabs\u002F1607.00653) (KDD 2016)\n\nAll included operations work on varying data types and are implemented both for CPU and GPU.\n\n## Installation\n\n### Binaries\n\nWe provide pip wheels for all major OS\u002FPyTorch\u002FCUDA combinations, see [here](https:\u002F\u002Fdata.pyg.org\u002Fwhl).\n\n#### PyTorch 2.11\n\nTo install the binaries for PyTorch 2.11, simply run\n\n```\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.11.0+${CUDA}.html\n```\n\nwhere `${CUDA}` should be replaced by either `cpu`, `cu126`, `cu128`, or `cu130` depending on your PyTorch installation.\n\n|             | `cpu` | `cu126` | `cu128` | `cu130` |\n|-------------|-------|---------|---------|---------|\n| **Linux**   | ✅    | ✅      | ✅      | ✅      |\n| **Windows** | ✅    | ✅      | ✅      | ✅      |\n| **macOS**   | ✅    |         |         |         |\n\n#### PyTorch 2.10\n\nTo install the binaries for PyTorch 2.10, simply run\n\n```\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.10.0+${CUDA}.html\n```\n\nwhere `${CUDA}` should be replaced by either `cpu`, `cu126`, `cu128`, or `cu130` depending on your PyTorch installation.\n\n|             | `cpu` | `cu126` | `cu128` | `cu130` |\n|-------------|-------|---------|---------|---------|\n| **Linux**   | ✅    | ✅      | ✅      | ✅      |\n| **Windows** | ✅    | ✅      | ✅      | ✅      |\n| **macOS**   | ✅    |         |         |         |\n\n#### PyTorch 2.9\n\nTo install the binaries for PyTorch 2.9, simply run\n\n```\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.9.0+${CUDA}.html\n```\n\nwhere `${CUDA}` should be replaced by either `cpu`, `cu126`, `cu128`, or `cu130` depending on your PyTorch installation.\n\n|             | `cpu` | `cu126` | `cu128` | `cu130` |\n|-------------|-------|---------|---------|---------|\n| **Linux**   | ✅    | ✅      | ✅      | ✅      |\n| **Windows** | ✅    | ✅      | ✅      | ✅      |\n| **macOS**   | ✅    |         |         |         |\n\n**Note:** Binaries of older versions are also provided for PyTorch 1.4.0, PyTorch 1.5.0, PyTorch 1.6.0, PyTorch 1.7.0\u002F1.7.1, PyTorch 1.8.0\u002F1.8.1, PyTorch 1.9.0, PyTorch 1.10.0\u002F1.10.1\u002F1.10.2, PyTorch 1.11.0, PyTorch 1.12.0\u002F1.12.1, PyTorch 1.13.0\u002F1.13.1, PyTorch 2.0.0\u002F2.0.1, PyTorch 2.1.0\u002F2.1.1\u002F2.1.2, PyTorch 2.2.0\u002F2.2.1\u002F2.2.2, PyTorch 2.3.0\u002F2.3.1, PyTorch 2.4.0\u002F2.4.1, PyTorch 2.5.0\u002F2.5.1, PyTorch 2.6.0, PyTorch 2.7.0\u002F2.7.1, and PyTorch 2.8.0 (following the same procedure).\nFor older versions, you need to explicitly specify the latest supported version number or install via `pip install --no-index` in order to prevent a manual installation from source.\nYou can look up the latest supported version number [here](https:\u002F\u002Fdata.pyg.org\u002Fwhl).\n\n### From source\n\nEnsure that at least PyTorch 1.4.0 is installed and verify that `cuda\u002Fbin` and `cuda\u002Finclude` are in your `$PATH` and `$CPATH` respectively, *e.g.*:\n\n```\n$ python -c \"import torch; print(torch.__version__)\"\n>>> 1.4.0\n\n$ python -c \"import torch; print(torch.__version__)\"\n>>> 1.1.0\n\n$ echo $PATH\n>>> \u002Fusr\u002Flocal\u002Fcuda\u002Fbin:...\n\n$ echo $CPATH\n>>> \u002Fusr\u002Flocal\u002Fcuda\u002Finclude:...\n```\n\nThen run:\n\n```\npip install torch-cluster\n```\n\nWhen running in a docker container without NVIDIA driver, PyTorch needs to evaluate the compute capabilities and may fail.\nIn this case, ensure that the compute capabilities are set via `TORCH_CUDA_ARCH_LIST`, *e.g.*:\n\n```\nexport TORCH_CUDA_ARCH_LIST = \"6.0 6.1 7.2+PTX 7.5+PTX\"\n```\n\n## Functions\n\n### Graclus\n\nA greedy clustering algorithm of picking an unmarked vertex and matching it with one its unmarked neighbors (that maximizes its edge weight).\nThe GPU algorithm is adapted from Fagginger Auer and Bisseling: [A GPU Algorithm for Greedy Graph Matching](http:\u002F\u002Fwww.staff.science.uu.nl\u002F~bisse101\u002FArticles\u002Fmatch12.pdf) (LNCS 2012)\n\n```python\nimport torch\nfrom torch_cluster import graclus_cluster\n\nrow = torch.tensor([0, 1, 1, 2])\ncol = torch.tensor([1, 0, 2, 1])\nweight = torch.tensor([1., 1., 1., 1.])  # Optional edge weights.\n\ncluster = graclus_cluster(row, col, weight)\n```\n\n```\nprint(cluster)\ntensor([0, 0, 1])\n```\n\n### VoxelGrid\n\nA clustering algorithm, which overlays a regular grid of user-defined size over a point cloud and clusters all points within a voxel.\n\n```python\nimport torch\nfrom torch_cluster import grid_cluster\n\npos = torch.tensor([[0., 0.], [11., 9.], [2., 8.], [2., 2.], [8., 3.]])\nsize = torch.Tensor([5, 5])\n\ncluster = grid_cluster(pos, size)\n```\n\n```\nprint(cluster)\ntensor([0, 5, 3, 0, 1])\n```\n\n### FarthestPointSampling\n\nA sampling algorithm, which iteratively samples the most distant point with regard to the rest points.\n\n```python\nimport torch\nfrom torch_cluster import fps\n\nx = torch.tensor([[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]])\nbatch = torch.tensor([0, 0, 0, 0])\nindex = fps(x, batch, ratio=0.5, random_start=False)\n```\n\n```\nprint(index)\ntensor([0, 3])\n```\n\n### kNN-Graph\n\nComputes graph edges to the nearest *k* points.\n\n**Args:**\n\n* **x** *(Tensor)*: Node feature matrix of shape `[N, F]`.\n* **k** *(int)*: The number of neighbors.\n* **batch** *(LongTensor, optional)*: Batch vector of shape `[N]`, which assigns each node to a specific example. `batch` needs to be sorted. (default: `None`)\n* **loop** *(bool, optional)*: If `True`, the graph will contain self-loops. (default: `False`)\n* **flow** *(string, optional)*: The flow direction when using in combination with message passing (`\"source_to_target\"` or `\"target_to_source\"`). (default: `\"source_to_target\"`)\n* **cosine** *(boolean, optional)*: If `True`, will use the Cosine distance instead of Euclidean distance to find nearest neighbors. (default: `False`)\n* **num_workers** *(int)*: Number of workers to use for computation. Has no effect in case `batch` is not `None`, or the input lies on the GPU. (default: `1`)\n\n```python\nimport torch\nfrom torch_cluster import knn_graph\n\nx = torch.tensor([[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]])\nbatch = torch.tensor([0, 0, 0, 0])\nedge_index = knn_graph(x, k=2, batch=batch, loop=False)\n```\n\n```\nprint(edge_index)\ntensor([[1, 2, 0, 3, 0, 3, 1, 2],\n        [0, 0, 1, 1, 2, 2, 3, 3]])\n```\n\n### Radius-Graph\n\nComputes graph edges to all points within a given distance.\n\n**Args:**\n\n* **x** *(Tensor)*: Node feature matrix of shape `[N, F]`.\n* **r** *(float)*: The radius.\n* **batch** *(LongTensor, optional)*: Batch vector of shape `[N]`, which assigns each node to a specific example. `batch` needs to be sorted. (default: `None`)\n* **loop** *(bool, optional)*: If `True`, the graph will contain self-loops. (default: `False`)\n* **max_num_neighbors** *(int, optional)*: The maximum number of neighbors to return for each element. If the number of actual neighbors is greater than `max_num_neighbors`, returned neighbors are picked randomly. (default: `32`)\n* **flow** *(string, optional)*: The flow direction when using in combination with message passing (`\"source_to_target\"` or `\"target_to_source\"`). (default: `\"source_to_target\"`)\n* **num_workers** *(int)*: Number of workers to use for computation. Has no effect in case `batch` is not `None`, or the input lies on the GPU. (default: `1`)\n\n```python\nimport torch\nfrom torch_cluster import radius_graph\n\nx = torch.tensor([[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]])\nbatch = torch.tensor([0, 0, 0, 0])\nedge_index = radius_graph(x, r=2.5, batch=batch, loop=False)\n```\n\n```\nprint(edge_index)\ntensor([[1, 2, 0, 3, 0, 3, 1, 2],\n        [0, 0, 1, 1, 2, 2, 3, 3]])\n```\n\n### Nearest\n\nClusters points in *x* together which are nearest to a given query point in *y*.\n`batch_{x,y}` vectors need to be sorted.\n\n```python\nimport torch\nfrom torch_cluster import nearest\n\nx = torch.Tensor([[-1, -1], [-1, 1], [1, -1], [1, 1]])\nbatch_x = torch.tensor([0, 0, 0, 0])\ny = torch.Tensor([[-1, 0], [1, 0]])\nbatch_y = torch.tensor([0, 0])\ncluster = nearest(x, y, batch_x, batch_y)\n```\n\n```\nprint(cluster)\ntensor([0, 0, 1, 1])\n```\n\n### RandomWalk-Sampling\n\nSamples random walks of length `walk_length` from all node indices in `start` in the graph given by `(row, col)`.\n\n```python\nimport torch\nfrom torch_cluster import random_walk\n\nrow = torch.tensor([0, 1, 1, 1, 2, 2, 3, 3, 4, 4])\ncol = torch.tensor([1, 0, 2, 3, 1, 4, 1, 4, 2, 3])\nstart = torch.tensor([0, 1, 2, 3, 4])\n\nwalk = random_walk(row, col, start, walk_length=3)\n```\n\n```\nprint(walk)\ntensor([[0, 1, 2, 4],\n        [1, 3, 4, 2],\n        [2, 4, 2, 1],\n        [3, 4, 2, 4],\n        [4, 3, 1, 0]])\n```\n\n## Running tests\n\n```\npytest\n```\n\n## C++ API\n\n`torch-cluster` also offers a C++ API that contains C++ equivalent of python models.\n\n```\nexport Torch_DIR=`python -c 'import torch;print(torch.utils.cmake_prefix_path)'`\nmkdir build\ncd build\n# Add -DWITH_CUDA=on support for the CUDA if needed\ncmake ..\nmake\nmake install\n```\n","[pypi-image]: https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Ftorch-cluster.svg\n[pypi-url]: https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Ftorch-cluster\n[testing-image]: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Factions\u002Fworkflows\u002Ftesting.yml\u002Fbadge.svg\n[testing-url]: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Factions\u002Fworkflows\u002Ftesting.yml\n[linting-image]: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Factions\u002Fworkflows\u002Flinting.yml\u002Fbadge.svg\n[linting-url]: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Factions\u002Fworkflows\u002Flinting.yml\n[coverage-image]: https:\u002F\u002Fcodecov.io\u002Fgh\u002Frusty1s\u002Fpytorch_cluster\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg\n[coverage-url]: https:\u002F\u002Fcodecov.io\u002Fgithub\u002Frusty1s\u002Fpytorch_cluster?branch=master\n\n# PyTorch Cluster\n\n[![PyPI 版本][pypi-image]][pypi-url]\n[![测试状态][testing-image]][testing-url]\n[![代码风格检查状态][linting-image]][linting-url]\n[![代码覆盖率][coverage-image]][coverage-url]\n\n--------------------------------------------------------------------------------\n\n本包是一个小型扩展库，包含高度优化的图聚类算法，专为 [PyTorch](http:\u002F\u002Fpytorch.org\u002F) 使用而设计。\n该包包含以下聚类算法：\n\n* **[Graclus](#graclus)** 算法，源自 Dhillon 等人：[无需特征向量的加权图划分：一种多级方法](http:\u002F\u002Fwww.cs.utexas.edu\u002Fusers\u002Finderjit\u002Fpublic_papers\u002Fmultilevel_pami.pdf)（PAMI 2007）\n* **[体素网格池化](#voxelgrid)** 算法，源自 Simonovsky 和 Komodakis 等人：[图卷积神经网络中的动态边条件滤波器](https:\u002F\u002Farxiv.org\u002Fabs\u002F1704.02901)（CVPR 2017）\n* **[迭代最远点采样](#farthestpointsampling)** 算法，源自 Qi 等人：[PointNet++：度量空间中点云的深度层次特征学习](https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.02413)（NIPS 2017）\n* **[k-NN](#knn-graph)** 和 **[半径](#radius-graph)** 图生成\n* 基于**[最近邻](#nearest)** 的聚类\n* **[随机游走采样](#randomwalk-sampling)** 算法，源自 Grover 和 Leskovec 等人：[node2vec：可扩展的网络特征学习](https:\u002F\u002Farxiv.org\u002Fabs\u002F1607.00653)（KDD 2016）\n\n所有包含的操作均可处理多种数据类型，并且同时支持 CPU 和 GPU。\n\n## 安装\n\n### 二进制包\n\n我们为所有主流操作系统、PyTorch 和 CUDA 组合提供了 pip 轮子文件，详情请见 [这里](https:\u002F\u002Fdata.pyg.org\u002Fwhl)。\n\n#### PyTorch 2.11\n\n要安装适用于 PyTorch 2.11 的二进制包，只需运行：\n\n```\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.11.0+${CUDA}.html\n```\n\n其中 `${CUDA}` 应根据您的 PyTorch 安装情况替换为 `cpu`、`cu126`、`cu128` 或 `cu130`。\n\n|             | `cpu` | `cu126` | `cu128` | `cu130` |\n|-------------|-------|---------|---------|---------|\n| **Linux**   | ✅    | ✅      | ✅      | ✅      |\n| **Windows** | ✅    | ✅      | ✅      | ✅      |\n| **macOS**   | ✅    |         |         |         |\n\n#### PyTorch 2.10\n\n要安装适用于 PyTorch 2.10 的二进制包，只需运行：\n\n```\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.10.0+${CUDA}.html\n```\n\n其中 `${CUDA}` 应根据您的 PyTorch 安装情况替换为 `cpu`、`cu126`、`cu128` 或 `cu130`。\n\n|             | `cpu` | `cu126` | `cu128` | `cu130` |\n|-------------|-------|---------|---------|---------|\n| **Linux**   | ✅    | ✅      | ✅      | ✅      |\n| **Windows** | ✅    | ✅      | ✅      | ✅      |\n| **macOS**   | ✅    |         |         |         |\n\n#### PyTorch 2.9\n\n要安装适用于 PyTorch 2.9 的二进制包，只需运行：\n\n```\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.9.0+${CUDA}.html\n```\n\n其中 `${CUDA}` 应根据您的 PyTorch 安装情况替换为 `cpu`、`cu126`、`cu128` 或 `cu130`。\n\n|             | `cpu` | `cu126` | `cu128` | `cu130` |\n|-------------|-------|---------|---------|---------|\n| **Linux**   | ✅    | ✅      | ✅      | ✅      |\n| **Windows** | ✅    | ✅      | ✅      | ✅      |\n| **macOS**   | ✅    |         |         |         |\n\n**注意：** 我们还为 PyTorch 1.4.0、1.5.0、1.6.0、1.7.0\u002F1.7.1、1.8.0\u002F1.8.1、1.9.0、1.10.0\u002F1.10.1\u002F1.10.2、1.11.0、1.12.0\u002F1.12.1、1.13.0\u002F1.13.1、2.0.0\u002F2.0.1、2.1.0\u002F2.1.1\u002F2.1.2、2.2.0\u002F2.2.1\u002F2.2.2、2.3.0\u002F2.3.1、2.4.0\u002F2.4.1、2.5.0\u002F2.5.1、2.6.0、2.7.0\u002F2.7.1 以及 2.8.0 提供了旧版本的二进制包（操作步骤相同）。\n对于旧版本，您需要明确指定最新支持的版本号，或者使用 `pip install --no-index` 进行安装，以避免手动从源码编译。\n您可以在 [这里](https:\u002F\u002Fdata.pyg.org\u002Fwhl) 查找最新支持的版本号。\n\n### 从源码安装\n\n请确保已安装至少 PyTorch 1.4.0，并验证 `cuda\u002Fbin` 和 `cuda\u002Finclude` 是否分别位于您的 `$PATH` 和 `$CPATH` 中，例如：\n\n```\n$ python -c \"import torch; print(torch.__version__)\"\n>>> 1.4.0\n\n$ python -c \"import torch; print(torch.__version__)\"\n>>> 1.1.0\n\n$ echo $PATH\n>>> \u002Fusr\u002Flocal\u002Fcuda\u002Fbin:...\n\n$ echo $CPATH\n>>> \u002Fusr\u002Flocal\u002Fcuda\u002Finclude:...\n```\n\n然后运行：\n\n```\npip install torch-cluster\n```\n\n在没有 NVIDIA 驱动的 Docker 容器中运行时，PyTorch 需要评估计算能力，可能会失败。\n在这种情况下，请通过设置 `TORCH_CUDA_ARCH_LIST` 来指定计算能力，例如：\n\n```\nexport TORCH_CUDA_ARCH_LIST = \"6.0 6.1 7.2+PTX 7.5+PTX\"\n```\n\n## 功能\n\n### Graclus\n\n一种贪心聚类算法，每次选择一个未标记的顶点，并将其与未标记的邻居中边权重最大的顶点配对。\nGPU 实现改编自 Fagginger Auer 和 Bisseling：[用于贪心图匹配的 GPU 算法](http:\u002F\u002Fwww.staff.science.uu.nl\u002F~bisse101\u002FArticles\u002Fmatch12.pdf)（LNCS 2012）\n\n```python\nimport torch\nfrom torch_cluster import graclus_cluster\n\nrow = torch.tensor([0, 1, 1, 2])\ncol = torch.tensor([1, 0, 2, 1])\nweight = torch.tensor([1., 1., 1., 1.])  # 可选的边权重。\n\ncluster = graclus_cluster(row, col, weight)\n```\n\n```\nprint(cluster)\ntensor([0, 0, 1])\n```\n\n### VoxelGrid\n\n一种聚类算法，它在点云上覆盖一个用户定义大小的规则网格，并将位于同一个体素内的点归为一类。\n\n```python\nimport torch\nfrom torch_cluster import grid_cluster\n\npos = torch.tensor([[0., 0.], [11., 9.], [2., 8.], [2., 2.], [8., 3.]])\nsize = torch.Tensor([5, 5])\n\ncluster = grid_cluster(pos, size)\n```\n\n```\nprint(cluster)\ntensor([0, 5, 3, 0, 1])\n```\n\n### FarthestPointSampling\n\n一种采样算法，每次从剩余点集中选取距离其他点最远的点进行采样。\n\n```python\nimport torch\nfrom torch_cluster import fps\n\nx = torch.tensor([[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]])\nbatch = torch.tensor([0, 0, 0, 0])\nindex = fps(x, batch, ratio=0.5, random_start=False)\n```\n\n```\nprint(index)\ntensor([0, 3])\n```\n\n### kNN-图\n\n计算与最近 *k* 个点之间的图边。\n\n**参数：**\n\n* **x** *(Tensor)*: 节点特征矩阵，形状为 `[N, F]`。\n* **k** *(int)*: 邻居的数量。\n* **batch** *(LongTensor, 可选)*: 批量向量，形状为 `[N]`，用于将每个节点分配到特定的示例。`batch` 需要排序。（默认值：`None`）\n* **loop** *(bool, 可选)*: 如果为 `True`，图将包含自环。（默认值：`False`）\n* **flow** *(string, 可选)*: 与消息传递结合使用时的流动方向（`\"source_to_target\"` 或 `\"target_to_source\"`）。（默认值：`\"source_to_target\"`）\n* **cosine** *(boolean, 可选)*: 如果为 `True`，将使用余弦距离代替欧几里得距离来寻找最近邻。（默认值：`False`）\n* **num_workers** *(int)*: 用于计算的工作线程数量。如果 `batch` 不为 `None`，或者输入位于 GPU 上，则此参数无效。（默认值：`1`）\n\n```python\nimport torch\nfrom torch_cluster import knn_graph\n\nx = torch.tensor([[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]])\nbatch = torch.tensor([0, 0, 0, 0])\nedge_index = knn_graph(x, k=2, batch=batch, loop=False)\n```\n\n```\nprint(edge_index)\ntensor([[1, 2, 0, 3, 0, 3, 1, 2],\n        [0, 0, 1, 1, 2, 2, 3, 3]])\n```\n\n### 半径-图\n\n计算与给定距离内所有点之间的图边。\n\n**参数：**\n\n* **x** *(Tensor)*: 节点特征矩阵，形状为 `[N, F]`。\n* **r** *(float)*: 半径。\n* **batch** *(LongTensor, 可选)*: 批量向量，形状为 `[N]`，用于将每个节点分配到特定的示例。`batch` 需要排序。（默认值：`None`）\n* **loop** *(bool, 可选)*: 如果为 `True`，图将包含自环。（默认值：`False`）\n* **max_num_neighbors** *(int, 可选)*: 每个元素最多返回的邻居数量。如果实际邻居数量超过 `max_num_neighbors`，则随机选择返回的邻居。（默认值：`32`）\n* **flow** *(string, 可选)*: 与消息传递结合使用时的流动方向（`\"source_to_target\"` 或 `\"target_to_source\"`）。（默认值：`\"source_to_target\"`）\n* **num_workers** *(int)*: 用于计算的工作线程数量。如果 `batch` 不为 `None`，或者输入位于 GPU 上，则此参数无效。（默认值：`1`）\n\n```python\nimport torch\nfrom torch_cluster import radius_graph\n\nx = torch.tensor([[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]])\nbatch = torch.tensor([0, 0, 0, 0])\nedge_index = radius_graph(x, r=2.5, batch=batch, loop=False)\n```\n\n```\nprint(edge_index)\ntensor([[1, 2, 0, 3, 0, 3, 1, 2],\n        [0, 0, 1, 1, 2, 2, 3, 3]])\n```\n\n### 最近邻\n\n将 *x* 中与 *y* 中给定查询点最近的点聚类在一起。\n`batch_{x,y}` 向量需要排序。\n\n```python\nimport torch\nfrom torch_cluster import nearest\n\nx = torch.Tensor([[-1, -1], [-1, 1], [1, -1], [1, 1]])\nbatch_x = torch.tensor([0, 0, 0, 0])\ny = torch.Tensor([[-1, 0], [1, 0]])\nbatch_y = torch.tensor([0, 0])\ncluster = nearest(x, y, batch_x, batch_y)\n```\n\n```\nprint(cluster)\ntensor([0, 0, 1, 1])\n```\n\n### 随机游走采样\n\n从由 `(row, col)` 给出的图中，从 `start` 中的所有节点索引处采样长度为 `walk_length` 的随机游走。\n\n```python\nimport torch\nfrom torch_cluster import random_walk\n\nrow = torch.tensor([0, 1, 1, 1, 2, 2, 3, 3, 4, 4])\ncol = torch.tensor([1, 0, 2, 3, 1, 4, 1, 4, 2, 3])\nstart = torch.tensor([0, 1, 2, 3, 4])\n\nwalk = random_walk(row, col, start, walk_length=3)\n```\n\n```\nprint(walk)\ntensor([[0, 1, 2, 4],\n        [1, 3, 4, 2],\n        [2, 4, 2, 1],\n        [3, 4, 2, 4],\n        [4, 3, 1, 0]])\n```\n\n## 运行测试\n\n```\npytest\n```\n\n## C++ API\n\n`torch-cluster` 还提供了一个 C++ API，其中包含了 Python 模型的 C++ 等效实现。\n\n```\nexport Torch_DIR=`python -c 'import torch;print(torch.utils.cmake_prefix_path)'`\nmkdir build\ncd build\n# 如需支持 CUDA，可添加 -DWITH_CUDA=on\ncmake ..\nmake\nmake install\n```","# PyTorch Cluster 快速上手指南\n\n`torch-cluster` 是一个为 PyTorch 设计的高性能图聚类算法扩展库，支持 CPU 和 GPU 加速。它提供了包括 Graclus、体素网格池化（Voxel Grid）、最远点采样（FPS）、k-NN 图构建等常用图神经网络操作。\n\n## 环境准备\n\n在开始之前，请确保满足以下系统要求：\n\n*   **操作系统**: Linux, Windows, 或 macOS\n*   **Python**: 3.6+\n*   **PyTorch**: 1.4.0 或更高版本（推荐 2.0+）\n*   **CUDA** (可选): 如需 GPU 加速，请确保已安装 NVIDIA 驱动，且 `cuda\u002Fbin` 和 `cuda\u002Finclude` 已加入环境变量 `$PATH` 和 `$CPATH`。\n\n验证 PyTorch 安装：\n```bash\npython -c \"import torch; print(torch.__version__)\"\n```\n\n## 安装步骤\n\n### 方法一：使用预编译二进制包（推荐）\n\n这是最快且最稳定的安装方式。请根据你的 PyTorch 版本和 CUDA 版本选择对应的命令。\n\n**注意**：请将 `${CUDA}` 替换为你的实际环境标识（如 `cpu`, `cu118`, `cu121` 等）。若不确定，可访问 [PyG Wheels](https:\u002F\u002Fdata.pyg.org\u002Fwhl) 查看支持的组合。\n\n**PyTorch 2.x 通用安装命令：**\n\n```bash\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.1.0+${CUDA}.html\n```\n\n*示例（PyTorch 2.1 + CUDA 11.8）：*\n```bash\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.1.0+cu118.html\n```\n\n*示例（仅 CPU 版本）：*\n```bash\npip install torch-cluster -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.1.0+cpu.html\n```\n\n> **国内加速提示**：如果下载速度慢，可在命令前添加国内镜像源参数，例如：\n> `pip install ... -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n\n### 方法二：从源码安装\n\n如果预编译包不匹配你的环境，可以选择从源码编译。需确保已安装 C++ 编译器和 CUDA Toolkit（如需 GPU）。\n\n```bash\npip install torch-cluster\n```\n\n**Docker 环境特别说明**：\n如果在无 NVIDIA 驱动的 Docker 容器中编译，需手动指定计算能力架构：\n```bash\nexport TORCH_CUDA_ARCH_LIST=\"6.0 6.1 7.0 7.5 8.0\"\npip install torch-cluster\n```\n\n## 基本使用\n\n以下展示最常用的 **k-NN 图构建** 和 **最远点采样 (FPS)** 功能。\n\n### 1. 构建 k-NN 图 (k-NN Graph)\n\n根据节点特征矩阵，为每个节点连接距离最近的 $k$ 个邻居。\n\n```python\nimport torch\nfrom torch_cluster import knn_graph\n\n# 节点特征矩阵 [N, F]\nx = torch.tensor([[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]])\n# Batch 向量，表示所有节点属于同一个图\nbatch = torch.tensor([0, 0, 0, 0])\n\n# 构建 k=2 的最近邻图\nedge_index = knn_graph(x, k=2, batch=batch, loop=False)\n\nprint(edge_index)\n# 输出: tensor([[1, 2, 0, 3, 0, 3, 1, 2],\n#               [0, 0, 1, 1, 2, 2, 3, 3]])\n```\n\n### 2. 最远点采样 (Farthest Point Sampling)\n\n迭代地采样距离已选点集最远的点，常用于点云下采样。\n\n```python\nimport torch\nfrom torch_cluster import fps\n\n# 点云坐标\nx = torch.tensor([[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]])\nbatch = torch.tensor([0, 0, 0, 0])\n\n# 采样比例为 50%，不从随机点开始\nindex = fps(x, batch, ratio=0.5, random_start=False)\n\nprint(index)\n# 输出: tensor([0, 3]) (具体结果可能因实现细节略有不同，但保证分散性)\n```\n\n### 3. 其他核心功能简述\n\n*   **Graclus 聚类**: `graclus_cluster(row, col, weight)` - 基于边权重的贪婪图聚类。\n*   **体素网格池化**: `grid_cluster(pos, size)` - 将点云划分为规则网格进行聚类。\n*   **半径图构建**: `radius_graph(x, r, batch)` - 连接半径 $r$ 内的所有点。\n*   **随机游走采样**: `random_walk(row, col, start, walk_length)` - 生成随机游走路径。\n\n所有函数均自动支持 GPU 张量输入，只需将 Tensor 移至 CUDA 设备即可加速计算。","某自动驾驶感知团队正在开发基于激光雷达点云的 3D 目标检测模型，需要对海量无序点云数据进行高效的下采样和局部邻域构建。\n\n### 没有 pytorch_cluster 时\n- **下采样效率低下**：使用纯 Python 或 NumPy 实现最远点采样（FPS）算法，在处理百万级点云时耗时数秒，严重拖慢训练迭代速度。\n- **邻域构建内存爆炸**：手动编写 k-NN 搜索逻辑需生成巨大的距离矩阵，导致显存瞬间溢出（OOM），无法处理大场景数据。\n- **GPU 利用率不足**：关键的数据预处理步骤被迫在 CPU 上运行，造成 GPU 在训练循环中频繁空闲等待，算力浪费严重。\n- **代码维护困难**：为了性能尝试编写自定义 CUDA 内核，但调试复杂且难以适配不同版本的 PyTorch 和 CUDA 环境。\n\n### 使用 pytorch_cluster 后\n- **推理速度飞跃**：直接调用 `farthest_point_sampling` GPU 算子，将万级点数的下采样时间从秒级降低至毫秒级，训练吞吐量提升 5 倍以上。\n- **显存占用优化**：利用优化的 `knn_graph` 和 `radius_graph` 函数，以稀疏张量形式高效构建邻接关系，轻松支撑大规模场景建模。\n- **端到端 GPU 加速**：所有图聚类与采样操作均在 GPU 上流水线执行，消除了 CPU-GPU 数据拷贝瓶颈，确保持续的高算力负载。\n- **部署便捷稳定**：通过 pip 即可安装预编译的二进制包，完美兼容主流 PyTorch 版本，无需关心底层 CUDA 实现细节。\n\npytorch_cluster 通过将复杂的图聚类算法转化为高效的 GPU 原生算子，让开发者能专注于模型创新而非底层性能优化。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Frusty1s_pytorch_cluster_f4c6229f.png","rusty1s","Matthias Fey","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Frusty1s_f9a7a316.jpg","Creator of PyG (PyTorch Geometric) - Founding Engineer @ Kumo.AI - PhD @ TU Dortmund University - Interested in Graph Representation Learning","Kumo.AI","Dortmund, Germany","matthias.fey@tu-dortmund.de","https:\u002F\u002Frusty1s.github.io","https:\u002F\u002Fgithub.com\u002Frusty1s",[82,86,90,94,97],{"name":83,"color":84,"percentage":85},"C++","#f34b7d",56.5,{"name":87,"color":88,"percentage":89},"Python","#3572A5",26.1,{"name":91,"color":92,"percentage":93},"Cuda","#3A4E3A",14.9,{"name":95,"color":96,"percentage":32},"CMake","#DA3434",{"name":98,"color":99,"percentage":100},"C","#555555",0.5,920,165,"2026-04-02T08:09:52","MIT","Linux, Windows, macOS","非必需（支持 CPU）。若使用 GPU，需 NVIDIA 显卡并安装对应的 CUDA 版本（支持 cu126, cu128, cu130 等，具体取决于 PyTorch 版本）。在 Docker 无驱动环境下需手动设置 TORCH_CUDA_ARCH_LIST。","未说明",{"notes":109,"python":110,"dependencies":111},"1. 该库提供预编译的二进制包（wheels），覆盖 PyTorch 1.4.0 至 2.11.0 的多个版本及不同的 CUDA 版本（cpu, cu126, cu128, cu130）。macOS 仅支持 CPU 版本。2. 从源码安装时，必须确保环境变量 $PATH 和 $CPATH 中包含 CUDA 的路径。3. 若在沒有 NVIDIA 驱动的 Docker 容器中从源码编译，需通过 export TORCH_CUDA_ARCH_LIST 指定计算能力架构（如 '6.0 7.5+PTX'），否则可能失败。","未说明（需与已安装的 PyTorch 版本兼容）",[112],"torch>=1.4.0",[14],[115,116,117,118],"pytorch","geometric-deep-learning","graph-neural-networks","cluster-algorithms",null,"2026-03-27T02:49:30.150509","2026-04-15T06:50:23.778500",[123,128,133,138,143,148],{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},33778,"Farthest Point Sampling (FPS) 算法是 PointNet++ 首次提出的吗？","不是。FPS 算法本身历史悠久，早于 PointNet++ 论文存在。PointNet++ 论文中使用的是一种基于贪心策略的 FPS 实现（通常随机选择第一个点），这属于近似 FPS。真正的“精确”FPS 可能需要通过凸包等方式选择初始点对，但在实际深度学习应用中，PointNet++ 采用的贪心近似算法通常已经足够有效。","https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fissues\u002F102",{"id":129,"question_zh":130,"answer_zh":131,"source_url":132},33779,"为什么 radius_graph 方法在 CPU 和 GPU 上返回的结果不同，或者与旧版本结果不一致？","这通常是由数值不稳定性引起的，而非代码逻辑错误。浮点数精度在 [-1, 1] 范围内表示的值更多，当点云坐标超出此范围（例如以米为单位的大数值）时，更容易出现精度问题，导致边界情况下的邻居判断差异。建议将点云数据归一化到 [-1, 1] 范围内以提高稳定性。此外，新版本为了支持 TorchScript 进行了重构，无法完全回退到旧版本行为，且旧版本在特定数据下同样存在数值不稳定问题。","https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fissues\u002F96",{"id":134,"question_zh":135,"answer_zh":136,"source_url":137},33780,"torch_cluster.nearest 的准确率为何低于 scikit-learn 或 scipy 的最近邻算法？","这种微小的准确率差异（例如 0.9994 vs 1.0）通常是由于浮点数计算的数值不稳定性造成的，特别是在处理距离非常接近的点时。这属于正常现象，并非算法实现错误。只要数据经过适当的归一化处理，这种差异通常在可接受范围内，不会影响大多数实际应用的效果。","https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fissues\u002F82",{"id":139,"question_zh":140,"answer_zh":141,"source_url":142},33781,"运行 NeighborSampler 时出现 'Segmentation fault (core dumped)' 错误怎么办？","这是因为 NeighborSampler 是一个仅支持 CPU 的操作。如果输入的 edge_index 或 data 对象位于 GPU 显存中，就会引发段错误。解决方法是确保在创建 NeighborSampler 之前，将所有相关数据（包括 edge_index 和 data 对象）移动到 CPU 上。例如，使用 .cpu() 方法或将设备参数指定为 'cpu'。","https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fissues\u002F33",{"id":144,"question_zh":145,"answer_zh":146,"source_url":147},33782,"如何在 Jetson 等嵌入式设备上解决 radius 测试偶尔失败的问题？","在 Jetson Xavier NX 等 ARM 架构设备上，由于底层数学库或浮点运算精度的细微差异，radius 相关的测试可能会出现偶发性失败（有时成功有时失败）。这通常被视为特定硬件平台上的数值精度边缘情况。如果功能在实际使用中正常，可以忽略测试报错；或者尝试调整测试的容差范围，亦或是检查是否使用了与标准 x86 环境兼容的 PyTorch 构建版本。","https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fissues\u002F109",{"id":149,"question_zh":150,"answer_zh":151,"source_url":127},33783,"FPS 代码中第 49 到 70 行的具体作用是什么？","这部分代码实现了 FPS 的核心贪心逻辑。它通过迭代方式工作：首先选择一个起始点（通常是随机的或固定的），然后在每一步中计算剩余所有点到已选点集的最小距离，并选择其中距离最大的点作为下一个采样点。虽然代码看起来简洁，但它利用向量化操作高效地完成了距离矩阵的更新和最大值的查找，无需额外的复杂数据结构即可实现完整的采样功能。",[153,158,163,168,173,178,183,188,193,198,203,208,213,218,223,228,233,238,243,248],{"id":154,"version":155,"summary_zh":156,"released_at":157},263637,"1.6.3","* 修复与 PyTorch \u003C 1.12 的向后兼容性问题\n* 移除模块导入时对函数的 `torch.jit.script` 转换","2023-10-12T06:54:28",{"id":159,"version":160,"summary_zh":161,"released_at":162},263638,"1.6.2","## 变更内容\n* 为 `fps`、`knn`、`radius` 函数添加 `batch_size` 参数（https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fpull\u002F175）\n* 扩展 FPS 算法，增加额外的 `ptr` 参数（https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fpull\u002F180）\n* 添加对 PyTorch 2.1.0 的支持（https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fpull\u002F191）\n\n## 新贡献者\n* @piotrchmiel 在 https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fpull\u002F175 中完成了首次贡献\n* @cimadure 在 https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fpull\u002F179 中完成了首次贡献\n* @dsciebu 在 https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fpull\u002F180 中完成了首次贡献\n* @AgarwalSaurav 在 https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fpull\u002F188 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Frusty1s\u002Fpytorch_cluster\u002Fcompare\u002F1.6.1...1.6.2","2023-10-06T08:34:56",{"id":164,"version":165,"summary_zh":166,"released_at":167},263639,"1.6.1","* 增加对 PyTorch 2.0 的支持\n* 在 `random_walk` 中增加返回采样边索引的支持 (#139)\n* 为 `knn`、`radius` 和 `graclus` 增加 `bf16` 支持 (#144)\n* 在 `nearest` 中为 `batch` 布局添加安全检查 (#168)","2023-03-16T18:03:36",{"id":169,"version":170,"summary_zh":171,"released_at":172},263640,"1.6.0","* 改进 `random_walk` 中 `num_nodes` 的计算（当 `num_nodes=None` 时）(#112)\n* 修复包含零点样本的批次中 `knn`\u002F`radius` 的计算问题\n* 大幅提升 `knn`\u002F`radius` 计算的效率\n* 添加半精度支持 (#119)","2022-03-11T11:56:16",{"id":174,"version":175,"summary_zh":176,"released_at":177},263641,"1.5.9","* 减小了共享库文件的大小\n* CUDA 轮子现在也可以在仅 CPU 的设备上运行\n* 为 CPU 功能添加了并行化策略\n* `fps` 现在可以接受不同批处理点集的不同比例，即 `ratio` 现在可以是一个 `torch.Tensor`\n* 修复了一个 bug：`radius` 在 CPU 和 CUDA 版本中计算出的结果略有差异","2021-03-01T13:58:47",{"id":179,"version":180,"summary_zh":181,"released_at":182},263642,"1.5.8","* PyTorch 1.7 的预编译轮子包\n* `random_walk` 现在通过拒绝采样支持 `q != 1` 和 `p != 1`","2020-10-31T12:11:22",{"id":184,"version":185,"summary_zh":186,"released_at":187},263643,"1.5.7","* PyTorch 1.6.0 的 wheel 包\n* 修复了 `radius` 中的一个 bug：`max_num_neighbors` 参数被忽略。","2020-08-05T07:35:36",{"id":189,"version":190,"summary_zh":191,"released_at":192},263644,"1.5.6","本次发布修复了新的 `knn` 和 `radius` CPU 实现中导致内存泄漏的一些问题。如果您当前正在使用 `torch-cluster==1.5.5`，强烈建议您更新该包。","2020-07-17T04:35:58",{"id":194,"version":195,"summary_zh":196,"released_at":197},263645,"1.5.5","* 由于 `knn` 和 `radius` 操作现已基于 `nanoflann` 而非 `scipy` 实现，`torch-cluster` 现在可以完全被 TorchScript 编译。","2020-06-22T20:33:29",{"id":199,"version":200,"summary_zh":201,"released_at":202},263646,"1.5.4","修复了 `fps` 的 CUDA 版本中的一个 bug。","2020-04-01T17:58:48",{"id":204,"version":205,"summary_zh":206,"released_at":207},263647,"1.5.3","Fixes regarding proper usage of `fps` and `radius`.","2020-03-24T11:01:58",{"id":209,"version":210,"summary_zh":211,"released_at":212},263648,"1.5.2","This release introduces traceable `torch-cluster` operators using `torch.jit.script`. As a result, PyTorch 1.4 is now required to install this package. We also provide Python wheels for common OS\u002FCUDA combinations (see README).","2020-03-17T04:13:47",{"id":214,"version":215,"summary_zh":216,"released_at":217},263649,"1.4.5","This release brings PyTorch 1.3 support to `torch-cluster`.","2019-10-14T11:33:13",{"id":219,"version":220,"summary_zh":221,"released_at":222},263650,"1.4.4","* PyTorch 1.2 update","2019-08-11T12:56:11",{"id":224,"version":225,"summary_zh":226,"released_at":227},263651,"1.4.3","* Random Walk Sampling API","2019-07-27T17:45:55",{"id":229,"version":230,"summary_zh":231,"released_at":232},263652,"1.4.2","Added `flow` argument to the `radius_graph` method.","2019-06-04T19:42:05",{"id":234,"version":235,"summary_zh":236,"released_at":237},263653,"1.4.1","* Added `flow` argument to the `knn_graph` method.","2019-06-04T18:37:32",{"id":239,"version":240,"summary_zh":241,"released_at":242},263654,"1.4.0","* Added NeighborSampler","2019-05-31T09:39:43",{"id":244,"version":245,"summary_zh":246,"released_at":247},263655,"1.3.0","* PyTorch 1.1.0","2019-05-01T09:26:31",{"id":249,"version":250,"summary_zh":251,"released_at":252},263656,"1.2.4","* multi-GPU support","2019-03-06T15:13:13"]