[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-parrt--tensor-sensor":3,"tool-parrt--tensor-sensor":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 真正成长为懂上",156804,2,"2026-04-15T11:34:33",[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":79,"owner_website":80,"owner_url":81,"languages":82,"stars":91,"forks":92,"last_commit_at":93,"license":94,"difficulty_score":32,"env_os":95,"env_gpu":96,"env_ram":96,"env_deps":97,"category_tags":105,"github_topics":106,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":117,"updated_at":118,"faqs":119,"releases":149},7747,"parrt\u002Ftensor-sensor","tensor-sensor","The goal of this library is to generate more helpful exception messages for matrix algebra expressions for numpy, pytorch, jax, tensorflow, keras, fastai. ","Tensor-Sensor 是一款专为深度学习开发者设计的开源调试库，旨在让矩阵代数运算中的报错信息更加清晰易懂。在使用 NumPy、PyTorch、JAX、TensorFlow 等主流框架时，张量维度不匹配是导致代码崩溃的常见原因，而原生报错往往晦涩难懂，难以快速定位问题所在。\n\nTensor-Sensor 通过增强异常提示信息，直接指出引发错误的具体运算符及操作数的形状（Shape），帮助开发者迅速理解维度冲突的根源。更独特的是，它支持在 Jupyter 环境中可视化代码执行过程，直观展示每个中间变量的张量维度，甚至能生成包含完整子表达式形状的抽象语法树，让复杂的矩阵运算逻辑一目了然。\n\n这款工具特别适合正在学习深度学习的初学者，以及需要频繁处理复杂张量运算的研究人员和工程师。无论是调试自定义网络层，还是检查数据输入维度，Tensor-Sensor 都能显著降低排查成本。目前该库已稳定发布 1.0 版本，兼容多种主流深度学习框架，是提升开发效率的实用助手。","# Tensor Sensor\n\nSee article [Clarifying exceptions and visualizing tensor operations in deep learning code](https:\u002F\u002Fexplained.ai\u002Ftensor-sensor\u002Findex.html) and [TensorSensor implementation slides](https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fraw\u002Fmaster\u002Ftalks\u002Ftensor-sensor.pdf) (PDF).\n\n(*As of September 2021, M1 macs experience illegal instructions in many of the tensor libraries installed via Anaconda, so you should expect TensorSensor to work only on Intel-based Macs at the moment. PyTorch appears to work.*)\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fparrt_tensor-sensor_readme_ca709b9e5e02.png\" width=\"50%\" align=\"right\">One of the biggest challenges when writing code to implement deep learning networks, particularly for us newbies, is getting all of the tensor (matrix and vector) dimensions to line up properly. It's really easy to lose track of tensor dimensionality in complicated expressions involving multiple tensors and tensor operations.  Even when just feeding data into predefined [Tensorflow](https:\u002F\u002Fwww.tensorflow.org\u002F) network layers, we still need to get the dimensions right. When you ask for improper computations, you're going to run into some less than helpful exception messages.  \n\nTo help myself and other programmers debug tensor code, I built this library.  TensorSensor clarifies exceptions by augmenting messages and visualizing Python code to indicate the shape of tensor variables (see figure to the right for a teaser). It works with [Tensorflow](https:\u002F\u002Fwww.tensorflow.org\u002F), [PyTorch](https:\u002F\u002Fpytorch.org\u002F), [JAX](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fjax), and [Numpy](https:\u002F\u002Fnumpy.org\u002F), as well as higher-level libraries like [Keras](https:\u002F\u002Fkeras.io\u002F) and [fastai](https:\u002F\u002Fwww.fast.ai\u002F).\n\n*TensorSensor is currently at 1.0 (December 2021)*.\n\n## Visualizations\n\nFor more, see [examples.ipynb at colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fparrt\u002Ftensor-sensor\u002Fblob\u002Fmaster\u002Ftesting\u002Fexamples.ipynb). (The github rendering does not show images for some reason: [examples.ipynb](testing\u002Fexamples.ipynb).)\n\n```python\nimport numpy as np\n\nn = 200         # number of instances\nd = 764         # number of instance features\nn_neurons = 100 # how many neurons in this layer?\n\nW = np.random.rand(d,n_neurons)\nb = np.random.rand(n_neurons,1)\nX = np.random.rand(n,d)\nwith tsensor.clarify() as c:\n    Y = W @ X.T + b\n```\n\nDisplays this in a jupyter notebook or separate window:\n\n\u003Cimg src=\"images\u002Fmm.svg\">\n\nInstead of the following default exception message:\n\n```\nValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 764 is different from 100)\n```\n\nTensorSensor augments the message with more information about which operator caused the problem and includes the shape of the operands:\n\n```\nCause: @ on tensor operand W w\u002Fshape (764, 100) and operand X.T w\u002Fshape (764, 200)\n```\n\nYou can also get the full computation graph for an expression that includes all of the sub-expression shapes.\n \n```python\nW = torch.rand(size=(2000,2000), dtype=torch.float64)\nb = torch.rand(size=(2000,1), dtype=torch.float64)\nh = torch.zeros(size=(1_000_000,), dtype=int)\nx = torch.rand(size=(2000,1))\nz = torch.rand(size=(2000,1), dtype=torch.complex64)\n\ntsensor.astviz(\"b = W@b + (h+3).dot(h) + z\", sys._getframe())\n```\n\nyields the following abstract syntax tree with shapes:\n\n\u003Cimg src=\"images\u002Fast.svg\" width=\"250\">\n\n## Install\n\n```\npip install tensor-sensor             # This will only install the library for you\npip install tensor-sensor[torch]      # install pytorch related dependency\npip install tensor-sensor[tensorflow] # install tensorflow related dependency\npip install tensor-sensor[jax]        # install jax, jaxlib\npip install tensor-sensor[all]        # install tensorflow, pytorch, jax\n```\n\nwhich gives you module `tsensor`. I developed and tested with the following versions\n\n```\n$ pip list | grep -i flow\ntensorflow                         2.5.0\ntensorflow-estimator               2.5.0\n$ pip list | grep -i numpy\nnumpy                              1.19.5\nnumpydoc                           1.1.0\n$ pip list | grep -i torch\ntorch                              1.10.0\ntorchvision                        0.10.0\n$ pip list | grep -i jax\njax                                0.2.20\njaxlib                             0.1.71\n```\n\n### Graphviz for tsensor.astviz()\n\nFor displaying abstract syntax trees (ASTs) with `tsensor.astviz(...)`, you need the `dot` executable from graphviz, not just the python library. \n\nOn **Mac**, do this before or after tensor-sensor install:\n\n```\nbrew install graphviz\n```\n\nOn **Windows**, apparently you need\n\n```\nconda install python-graphviz  # Do this first; get's dot executable and py lib\npip install tensor-sensor      # Or one of the other installs\n```\n\n\n## Limitations\n\nI rely on parsing lines that are assignments or expressions only so the clarify and explain routines do not handle methods expressed like:\n\n```\ndef bar(): b + x * 3\n```\n\nInstead, use\n\n```\ndef bar():\n\tb + x * 3\n```\n\nwatch out for side effects!  I don't do assignments, but any functions you call with side effects will be done while I reevaluate statements.\n\nCan't handle `\\` continuations.\n\nWith Python `threading` package, don't use multiple threads calling clarify(). `multiprocessing` package should be fine.\n\nAlso note: I've built my own parser to handle just the assignments \u002F expressions tsensor can handle.\n\n## Deploy (parrt's use)\n\n```bash\n$ python setup.py sdist upload \n```\n\nOr download and install locally\n\n```bash\n$ cd ~\u002Fgithub\u002Ftensor-sensor\n$ pip install .\n```\n\n### TODO\n\n* can i call pyviz in debugger?\n","# 张量传感器\n\n请参阅文章[澄清深度学习代码中的异常并可视化张量操作](https:\u002F\u002Fexplained.ai\u002Ftensor-sensor\u002Findex.html)以及[TensorSensor实现幻灯片](https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fraw\u002Fmaster\u002Ftalks\u002Ftensor-sensor.pdf)（PDF）。\n\n（截至2021年9月，M1芯片的Mac在使用Anaconda安装的许多张量库时会遇到非法指令错误，因此目前TensorSensor预计仅能在基于Intel的Mac上运行。PyTorch似乎可以正常工作。）\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fparrt_tensor-sensor_readme_ca709b9e5e02.png\" width=\"50%\" align=\"right\">编写实现深度学习网络的代码时，最大的挑战之一，尤其是对于我们这些新手来说，就是确保所有张量（矩阵和向量）的维度正确对齐。在涉及多个张量和张量运算的复杂表达式中，很容易迷失张量的维度信息。即使只是将数据输入到预定义的[TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F)网络层中，我们也仍然需要确保维度正确。如果请求了不合法的计算，就会遇到一些不太友好的异常信息。\n\n为了帮助自己和其他程序员调试张量代码，我构建了这个库。TensorSensor通过增强异常消息并可视化Python代码来指示张量变量的形状，从而澄清异常（右侧图示为预览）。它支持[TensorFlow](https:\u002F\u002Fwww.tensorflow.org\u002F)、[PyTorch](https:\u002F\u002Fpytorch.org\u002F)、[JAX](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fjax)和[Numpy](https:\u002F\u002Fnumpy.org\u002F)，以及更高层次的库如[Keras](https:\u002F\u002Fkeras.io\u002F)和[fastai](https:\u002F\u002Fwww.fast.ai\u002F)。\n\n*TensorSensor目前版本为1.0（2021年12月）*。\n\n## 可视化效果\n\n更多内容请参见[colab上的examples.ipynb](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fparrt\u002Ftensor-sensor\u002Fblob\u002Fmaster\u002Ftesting\u002Fexamples.ipynb)。（由于某种原因，GitHub渲染无法显示图片：[examples.ipynb](testing\u002Fexamples.ipynb)。）\n\n```python\nimport numpy as np\n\nn = 200         # 样本数量\nd = 764         # 每个样本的特征数\nn_neurons = 100 # 该层有多少个神经元？\n\nW = np.random.rand(d,n_neurons)\nb = np.random.rand(n_neurons,1)\nX = np.random.rand(n,d)\nwith tsensor.clarify() as c:\n    Y = W @ X.T + b\n```\n\n在Jupyter笔记本或单独窗口中显示如下：\n\n\u003Cimg src=\"images\u002Fmm.svg\">\n\n而不是默认的以下异常信息：\n\n```\nValueError: matmul: 输入操作数1的核心维度0不匹配，与通用函数签名 (n?,k),(k,m?)->(n?,m?) 不符（大小764与100不同）\n```\n\nTensorSensor会增强消息，提供更多关于导致问题的操作符的信息，并附上操作数的形状：\n\n```\n原因：@ 运算符作用于形状为(764, 100)的张量W和形状为(764, 200)的X.T\n```\n\n你还可以获取包含所有子表达式形状的完整计算图。\n\n```python\nW = torch.rand(size=(2000,2000), dtype=torch.float64)\nb = torch.rand(size=(2000,1), dtype=torch.float64)\nh = torch.zeros(size=(1_000_000,), dtype=int)\nx = torch.rand(size=(2000,1))\nz = torch.rand(size=(2000,1), dtype=torch.complex64)\n\ntsensor.astviz(\"b = W@b + (h+3).dot(h) + z\", sys._getframe())\n```\n\n生成带有形状信息的抽象语法树：\n\n\u003Cimg src=\"images\u002Fast.svg\" width=\"250\">\n\n## 安装\n\n```\npip install tensor-sensor             # 这将仅为您安装库\npip install tensor-sensor[torch]      # 安装PyTorch相关依赖\npip install tensor-sensor[tensorflow] # 安装TensorFlow相关依赖\npip install tensor-sensor[jax]        # 安装JAX及jaxlib\npip install tensor-sensor[all]        # 安装TensorFlow、PyTorch和JAX\n```\n\n这将为您提供模块`tsensor`。我在以下版本上进行了开发和测试：\n\n```\n$ pip list | grep -i flow\ntensorflow                         2.5.0\ntensorflow-estimator               2.5.0\n$ pip list | grep -i numpy\nnumpy                              1.19.5\nnumpydoc                           1.1.0\n$ pip list | grep -i torch\ntorch                              1.10.0\ntorchvision                        0.10.0\n$ pip list | grep -i jax\njax                                0.2.20\njaxlib                             0.1.71\n```\n\n### Graphviz用于tsensor.astviz()\n\n要使用`tsensor.astviz(...)`显示抽象语法树（AST），你需要Graphviz中的`dot`可执行文件，而不仅仅是Python库。\n\n在**Mac**上，请在安装TensorSensor之前或之后执行：\n\n```\nbrew install graphviz\n```\n\n在**Windows**上，显然需要：\n\n```\nconda install python-graphviz  # 先执行此命令；会获得dot可执行文件和Python库\npip install tensor-sensor      # 或者选择其他安装方式\n```\n\n\n## 局限性\n\n我仅依赖于解析赋值语句或表达式行，因此clarify和explain例程无法处理如下形式的方法调用：\n\n```\ndef bar(): b + x * 3\n```\n\n应改为：\n\n```\ndef bar():\n\tb + x * 3\n```\n\n请注意副作用！我不处理赋值操作，但如果你调用的任何函数具有副作用，在我重新评估语句的过程中它们也会被执行。\n\n无法处理反斜杠续行。\n\n使用Python `threading`包时，不要让多个线程同时调用clarify()。而`multiprocessing`包应该没有问题。\n\n另外需要注意的是：我构建了自己的解析器，专门用于处理TensorSensor能够处理的赋值和表达式。\n\n## 部署（parrt的使用）\n\n```bash\n$ python setup.py sdist upload \n```\n\n或者下载并在本地安装：\n\n```bash\n$ cd ~\u002Fgithub\u002Ftensor-sensor\n$ pip install .\n```\n\n### 待办事项\n\n* 是否可以在调试器中调用pyviz？","# Tensor Sensor 快速上手指南\n\nTensor Sensor 是一个用于调试深度学习代码的 Python 库，旨在帮助开发者理清张量（矩阵\u002F向量）的维度匹配问题。它能通过增强异常报错信息和可视化代码执行过程，直观地展示张量形状，适用于 TensorFlow、PyTorch、JAX 和 NumPy 等主流框架。\n\n## 环境准备\n\n*   **操作系统**：\n    *   推荐 **Intel 架构**的 macOS、Linux 或 Windows。\n    *   ⚠️ **注意**：截至 2021 年 9 月，通过 Anaconda 安装的许多张量库在 **M1 Mac** 上会出现非法指令错误，导致 Tensor Sensor 无法正常工作（尽管 PyTorch 本身可能正常）。\n*   **Python 版本**：兼容主流 Python 3.x 版本。\n*   **前置依赖**：\n    *   基础功能仅需安装本库。\n    *   若需使用 `tsensor.astviz()` 生成抽象语法树可视化图像，必须安装系统级的 **Graphviz** 工具（不仅仅是 Python 包）：\n        *   **macOS**: `brew install graphviz`\n        *   **Windows**: 建议先执行 `conda install python-graphviz` 获取可执行文件，再安装 Python 库。\n        *   **Linux**: `sudo apt-get install graphviz` (Ubuntu\u002FDebian) 或对应发行版命令。\n\n## 安装步骤\n\n使用 pip 进行安装，可根据需要选择安装特定的深度学习框架依赖。国内用户建议使用清华或阿里镜像源加速下载。\n\n```bash\n# 仅安装核心库\npip install tensor-sensor -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 安装 PyTorch 相关依赖\npip install tensor-sensor[torch] -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 安装 TensorFlow 相关依赖\npip install tensor-sensor[tensorflow] -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 安装 JAX 相关依赖\npip install tensor-sensor[jax] -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 一次性安装所有框架依赖 (TensorFlow, PyTorch, JAX)\npip install tensor-sensor[all] -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n*开发测试参考版本：TensorFlow 2.5.0, PyTorch 1.10.0, JAX 0.2.20, NumPy 1.19.5*\n\n## 基本使用\n\n### 1. 增强异常报错信息 (Clarify Exceptions)\n\n当张量维度不匹配时，原生报错往往晦涩难懂。使用 `tsensor.clarify()` 上下文管理器可以捕获错误并输出包含具体操作符和张量形状的清晰提示。\n\n```python\nimport numpy as np\nimport tsensor\n\nn = 200         # 样本数量\nd = 764         # 特征数量\nn_neurons = 100 # 神经元数量\n\nW = np.random.rand(d, n_neurons)\nb = np.random.rand(n_neurons, 1)\nX = np.random.rand(n, d)\n\n# 使用 clarify 上下文包裹可能出错的代码\nwith tsensor.clarify() as c:\n    # 此处故意制造维度错误：W (764, 100) @ X.T (764, 200) 无法相乘\n    Y = W @ X.T + b\n```\n\n**效果对比：**\n*   **原生报错**：`ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0...`\n*   **Tensor Sensor 增强后**：\n    ```text\n    Cause: @ on tensor operand W w\u002Fshape (764, 100) and operand X.T w\u002Fshape (764, 200)\n    ```\n    *(在 Jupyter Notebook 中还会自动弹出可视化的矩阵运算示意图)*\n\n### 2. 可视化计算图与张量形状 (AST Visualization)\n\n使用 `tsensor.astviz()` 可以生成包含所有子表达式形状的抽象语法树（AST），帮助理解复杂表达式的计算流程。\n\n```python\nimport torch\nimport tsensor\nimport sys\n\nW = torch.rand(size=(2000, 2000), dtype=torch.float64)\nb = torch.rand(size=(2000, 1), dtype=torch.float64)\nh = torch.zeros(size=(1_000_000,), dtype=int)\nx = torch.rand(size=(2000, 1))\nz = torch.rand(size=(2000, 1), dtype=torch.complex64)\n\n# 将表达式作为字符串传入，并传递当前帧对象\ntsensor.astviz(\"b = W@b + (h+3).dot(h) + z\", sys._getframe())\n```\n\n执行后将生成一张 SVG 图片，清晰展示每个运算节点的输入输出形状。\n\n### ⚠️ 使用限制与注意事项\n\n1.  **代码格式**：解析器仅支持独立的赋值语句或表达式。请勿将表达式写在单行函数定义中（如 `def bar(): b + x`），应将其放在函数体内部多行书写。\n2.  **副作用**：库会通过重新评估语句来工作，请避免在 monitored 代码块中调用具有副作用（side effects）的函数。\n3.  **续行符**：不支持使用 `\\` 进行代码换行。\n4.  **多线程**：在使用 Python `threading` 模块时，不要在多个线程中同时调用 `clarify()`；使用 `multiprocessing` 通常没有问题。","一位深度学习工程师正在调试一个自定义的多层神经网络模型，在构建中间特征融合层时，突然遭遇了程序崩溃，急需定位张量维度不匹配的具体位置。\n\n### 没有 tensor-sensor 时\n- 面对原生框架（如 PyTorch 或 TensorFlow）抛出的报错，只能看到晦涩的底层运算签名（如 `gufunc signature`），完全无法直观理解是哪一步矩阵乘法出了问题。\n- 错误信息仅提示维度大小不符（例如\"size 764 is different from 100\"），却未明确指出是权重矩阵 $W$、输入数据 $X$ 还是偏置项 $b$ 导致了冲突。\n- 开发者不得不手动在代码中插入大量 `print(tensor.shape)` 语句，反复运行代码来逐个排查表达式中每个子项的形状，调试效率极低且打断心流。\n\n### 使用 tensor-sensor 后\n- tensor-sensor 能自动拦截异常并增强报错信息，直接指出是代码中的 `@` 运算符在处理特定变量时发生了维度冲突，并清晰列出参与运算的两个张量的具体形状。\n- 在 Jupyter 环境中，它能将复杂的数学表达式可视化为带形状标注的计算图，让开发者一眼就能看出 $W @ X.T$ 中哪个维度的连线断裂，无需猜测。\n- 支持对整行复杂表达式进行抽象语法树（AST）分析，一次性展示所有子表达式（如 `(h+3).dot(h)`）的推导形状，彻底消除了手动打印调试的繁琐过程。\n\ntensor-sensor 的核心价值在于将令人困惑的“维度对齐”难题转化为直观的视觉反馈和清晰的自然语言解释，让开发者从猜谜式的调试中解放出来。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fparrt_tensor-sensor_ca709b9e.png","parrt","Terence Parr","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fparrt_24191efb.jpg","Tech lead at Google, ex-Professor of computer\u002Fdata science, active contributor to open-source projects supporting developers. Creator of ANTLR parser generator.",null,"San Francisco","parrt@antlr.org","the_antlr_guy","http:\u002F\u002Fexplained.ai","https:\u002F\u002Fgithub.com\u002Fparrt",[83,87],{"name":84,"color":85,"percentage":86},"Jupyter Notebook","#DA5B0B",89.3,{"name":88,"color":89,"percentage":90},"Python","#3572A5",10.7,811,39,"2026-04-10T04:56:02","MIT","macOS (Intel), Windows, Linux","未说明",{"notes":98,"python":96,"dependencies":99},"截至 2021 年 9 月，通过 Anaconda 安装的张量库在 M1 Mac 上会出现非法指令错误，因此该工具目前仅支持基于 Intel 的 Mac（PyTorch 除外）。使用 astviz 功能可视化抽象语法树时，必须安装系统级的 Graphviz 'dot' 可执行文件，而不仅仅是 Python 库。在 Windows 上建议先通过 conda 安装 python-graphviz。该工具不支持多线程调用 clarify()，但支持 multiprocessing。代码解析仅支持赋值语句或表达式，不支持单行函数定义或反斜杠续行。",[100,101,102,103,104],"tensorflow>=2.5.0","torch>=1.10.0","jax>=0.2.20","numpy>=1.19.5","graphviz (系统级可执行文件)",[16,14],[107,108,109,110,111,112,113,114,115,116],"numpy","pytorch","matrix","vector","debugging","tracing","deep-learning","python","tensorflow","jax","2026-03-27T02:49:30.150509","2026-04-16T01:43:24.966894",[120,125,130,135,140,144],{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},34677,"为什么安装 tensor-sensor 时会强制安装 TensorFlow 或 PyTorch，即使我只想要基础功能？","这是一个已修复的打包问题。维护者已发布新版本（0.1b3 及以上）解决了可选依赖项配置错误的问题。请运行以下命令升级到最新版本：\npip install -U tensor-sensor\n如果仍然遇到问题，可以暂时使用 --no-deps 标志安装，然后手动安装所需依赖：\npip install tensor-sensor --no-deps\npip install graphviz","https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fissues\u002F8",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},34678,"我是 Keras\u002FTensorFlow 用户，没有安装 PyTorch，为什么导入时会报错 'No module named torch'？","早期版本在 analysis.py 中硬编码了对 torch.Size 的检查，导致非 PyTorch 用户导入失败。该问题已在 PR #10 中修复。请确保升级到最新版本：\npip install -U tensor-sensor\n升级后，库将不再强制要求安装 PyTorch，Keras 和 TensorFlow 用户可以正常使用。","https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fissues\u002F9",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},34679,"tensor-sensor 支持 JAX 框架吗？","是的，tensor-sensor 支持 JAX。由于 JAX 的 API 与 NumPy 几乎相同，因此可以直接使用。维护者已确认支持，并且社区用户反馈其在处理 JAX 的广播（broadcasting）和重塑（reshaping）操作调试时非常有效，能够像魔法一样简化问题排查。","https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fissues\u002F17",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},34680,"在 Mac 上生成的图表默认字体间距不正确怎么办？","这是 Matplotlib 字体回退机制导致的问题。默认字体在某些系统上显示异常。解决方案是显式指定字体名称，例如使用 \"Courier New\"。代码示例如下：\nwith ts.explain(fontname=\"Courier New\"):\n    y = np.multiply.outer(x, np.arange(2.0))\n此外，Matplotlib 会处理字体逻辑，如果指定字体不存在，它会回退到 DejaVu Sans，你可以通过设置默认字体配置来解决全局问题。","https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fissues\u002F34",{"id":141,"question_zh":142,"answer_zh":143,"source_url":129},34681,"如何在非 Jupyter 环境（如命令行脚本）中查看 tensor-sensor 生成的可视化图像？","在非 Jupyter 环境中运行时，tensor-sensor 会自动弹出一个类似 Matplotlib 风格的窗口来显示图像。只需确保已更新到最新版本并正常运行代码即可：\npip install -U tensor-sensor\n当你在 Shell 中运行脚本时，图像窗口会自动弹出，无需额外配置。",{"id":145,"question_zh":146,"answer_zh":147,"source_url":148},34682,"如何调试 PyTorch 中张量数据类型意外转换（如 int 转 float）导致的错误？","tensor-sensor 可以帮助揭示被隐藏的张量元素类型信息。常见的痛点是 PyTorch 会将全整数张量意外转换为浮点数，导致后续作为索引使用时报错，或者在 32 位和 64 位浮点数之间发生隐式转换。使用 tensor-sensor 的 explain 功能可以直观地看到张量的维度以及具体的元素类型（dtype），从而快速定位类型不匹配的问题。","https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fissues\u002F25",[150,155,160,165,169,174,178,183,188,192,197,201,205,209,213],{"id":151,"version":152,"summary_zh":153,"released_at":154},272001,"1.0","库目前运行正常且稳定，因此发布了 1.0 版本。感谢 @sbrugman，我们现在同时使用颜色和文本显示张量的元素类型信息。颜色表示类型（整数、浮点数、复数等），而透明度则表示精度：颜色越饱和，精度越高。GitHub 现在似乎不太能很好地渲染包含图片的笔记本，所以请查看 [Colab 版本](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fparrt\u002Ftensor-sensor\u002Fblob\u002Fmaster\u002Ftesting\u002Fexamples.ipynb)。\n\n请参阅 @sbrugman 提交的 PR [包含 dtype 信息](https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fpull\u002F35)，以及我随后做出的更改。","2021-12-11T21:24:11",{"id":156,"version":157,"summary_zh":158,"released_at":159},272002,"0.1.3","一些小改进（感谢 @sbrugman）：\n\n* [允许在 `tsensor.explain()` 中使用 `savefig` 参数保存非 `.svg` 文件](https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fpull\u002F27)\n* [对于超过 3 维的数据，使用 LaTeX 的 `\\times` 而不是 `x` 表示维度乘积](https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fpull\u002F26)\n* [修复：指定等宽字体的回退字体](https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fpull\u002F36)\n\n此外还进行了一些代码清理。","2021-09-27T20:11:58",{"id":161,"version":162,"summary_zh":163,"released_at":164},272003,"0.1.2","实际上，这是在2021年5月26日发布的。对解析树的构建进行了清理，以正确地[处理忽略带括号的子表达式](https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fmilestone\u002F7?closed=1)。","2021-09-27T20:11:34",{"id":166,"version":167,"summary_zh":76,"released_at":168},272004,"0.1.1","2020-12-03T20:46:15",{"id":170,"version":171,"summary_zh":172,"released_at":173},272005,"0.1","该库目前看起来已经足够稳定，因此我已将其从 Beta 版本正式发布为 0.1 版。主要的新特性是增加了对 JAX 的支持，不过你也可以查看 0.1 版的所有 [问题和 Pull Request](https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fmilestone\u002F5?closed=1)。","2020-12-03T20:17:42",{"id":175,"version":176,"summary_zh":76,"released_at":177},272006,"0.1b6","2020-10-16T20:46:41",{"id":179,"version":180,"summary_zh":181,"released_at":182},272007,"0.1b5","已修复 https:\u002F\u002Fgithub.com\u002Fparrt\u002Ftensor-sensor\u002Fissues\u002F4","2020-10-12T16:57:10",{"id":184,"version":185,"summary_zh":186,"released_at":187},272008,"0.1b4","感谢@noklam的辛勤工作！","2020-10-10T17:28:16",{"id":189,"version":190,"summary_zh":76,"released_at":191},272009,"0.1b3","2020-10-10T16:05:56",{"id":193,"version":194,"summary_zh":195,"released_at":196},272010,"0.1b1","与[文章](https:\u002F\u002Fexplained.ai\u002Ftensor-sensor\u002Findex.html)的发布同时进行。","2020-10-06T22:11:38",{"id":198,"version":199,"summary_zh":76,"released_at":200},272011,"0.1a6","2020-09-12T19:34:44",{"id":202,"version":203,"summary_zh":76,"released_at":204},272012,"0.1a5","2020-09-11T19:25:45",{"id":206,"version":207,"summary_zh":76,"released_at":208},272013,"0.1a4","2020-09-11T19:14:07",{"id":210,"version":211,"summary_zh":76,"released_at":212},272014,"0.1a3","2020-09-10T01:20:47",{"id":214,"version":215,"summary_zh":76,"released_at":216},272015,"0.1a1","2020-09-02T21:51:23"]