tensorViz: Letting AI Coding Assistants Truly 'See' Inside PyTorch Models

tensorViz gives AI coding assistants a chain of evidence for PyTorch runtime shapes through measured forward passes.
tensorViz is an open-source tool for AI coding assistants. It runs a real forward pass on a PyTorch model, records the measured shapes of each module and tensor, and generates a queryable computation graph. Claude Code, Codex, and Cursor can query this graph to fix dimension mismatches based on evidence rather than reverse-engineering shapes from code text. It also offers an install-free Model Explorer with 560+ paper model graphs. The article sees this as a new direction for building a runtime perception layer for agents, though dynamic graph coverage, large-model friendliness, and model library timeliness still need verification.
When Coding Agents Meet PyTorch: They Can See the Code, But Not the Data Flow
AI coding assistants can already read and modify PyTorch code, but they have a fundamental blind spot: they have never seen what the data actually looks like when a model is running. You can hand a model definition to Claude Code, Codex, or Cursor and ask them to help troubleshoot shape mismatches or incorrect module connections, but they can only make inferences based on the code text—essentially, they are "guessing."
tensorViz attempts to fill this gap. Its approach is straightforward: run a real forward pass on the model, record the actual shapes of every module and every tensor into an interactive computation graph. Coding agents can query this graph and read the measured shapes, thereby modifying model code based on evidence rather than speculation.

The project appeared on Product Hunt as an open-source developer tool with a clear positioning—not yet another model visualization dashboard, but infrastructure that provides "eyes" for AI coding assistants.
Core Mechanism: One Forward Pass Buys a Queryable Chain of Evidence
Traditional model visualization tools (such as Netron and TensorBoard's graph view) serve human readers: you open a browser, click through each layer with a mouse, and inspect shapes and parameters. tensorViz takes a different approach—it converts visualization results into structured data that agents can query.
Where Shapes Come From: Measured, Not Statically Inferred
Static graph analysis of PyTorch fails in many scenarios—dynamic control flow, conditional branches, and variable sequence lengths all make pure code-level shape inference unreliable. tensorViz chooses to run a real forward pass, and the shapes it obtains are measured at runtime, which is closer to actual behavior than any static analysis.
Static graph analysis refers to inferring tensor shapes by parsing source code or intermediate representations without executing the program. PyTorch uses a dynamic graph (define-by-run) mechanism, where the computation graph is dynamically constructed on each forward pass. As a result, Python control flow such as if x.sum() > 0:, variable-length sequences, and reshape operations that depend on runtime values cannot be accurately captured by static analysis. In contrast, a real forward pass (eager execution) actually executes all operators, and the recorded shapes reflect what truly happens at runtime. tensorViz leverages PyTorch's hook mechanism (such as register_forward_hook) to capture the input and output tensor shapes of each module during the forward pass, thereby obtaining a chain of evidence fully consistent with runtime behavior. This "execute once, record once" strategy is more reliable than any symbolic shape inference in dynamic graph scenarios.
How Agents Use It: Querying the Graph Rather Than Reading It
Tools like Claude Code, Codex, and Cursor access the graph generated by tensorViz through a retrieval interface, reading the measured shapes of each module and tensor. When a model reports a dimension mismatch, the agent can directly look up the actual output shape of a given layer instead of reverse-engineering it from the nn.Linear parameters in the code. In theory, this "evidence-driven" debugging approach can significantly reduce trial and error.
Retrieval interface here refers to an agent's ability to access external structured data through tool calls or function calling. Coding agents such as Claude Code, Codex, and Cursor typically support MCP (Model Context Protocol) or custom tool registration, enabling them to proactively query external information during code generation. The graph generated by tensorViz needs to be exposed in a format that agents can parse (such as a JSON node list or a graph query API) so that agents can retrieve the shapes of specific modules on demand. If the retrieval interface is well designed, an agent can query the actual output dimension of an upstream module before modifying the in_features of an nn.Linear, thereby avoiding blind changes. This "query first, then modify" paradigm essentially introduces a verifiable source of runtime facts into the agent workflow, reducing over-reliance on code text.
Zero-Install Path: 560+ Paper Models Available for Direct Browsing
Users who do not want to install anything locally have another option: tensorViz provides Model Explorer, which includes graphs of more than 560 models from recent papers that can be browsed and discussed directly. This figure comes from the official introduction; for researchers who want to quickly understand the structure of a paper's model, it saves the steps of setting up an environment and running the model themselves.
Why This Matters: The "Perception Layer" of AI Coding Is Taking Shape
Over the past year, improvements in coding agents' capabilities have mainly focused on code understanding and generation, but one often overlooked fact is that agents' perception of program runtime is extremely limited. They can read logs and run tests, but they lack direct means of observing "what data structures actually look like at runtime."
tensorViz represents a new line of thinking—building dedicated runtime perception tools for agents. It does not aim to replace human visualization interfaces, but rather to organize runtime information into an agent-friendly format. Similar directions include providing agents with measured database schema results, API response samples, and so on. The common thread among these tools is: turning the "invisible runtime" into "queryable evidence."
Another notable point is the open-source license (MIT). Model visualization itself is not a new track, but tools adapted for AI coding assistants are still scarce. The MIT license means it can be integrated into various workflows and may also spawn more tools of the same kind.
Runtime perception refers to an agent's ability to obtain real state information during program execution, as distinct from indirect inference relying solely on static code, logs, or test output. Traditionally, developers observe runtime state through breakpoint debugging, print statements, or profilers, but these methods are not agent-friendly—they require interactive sessions or large amounts of unstructured text. The core of perception tools built for agents lies in transforming runtime information into a structured, queryable format, such as tensor shape graphs, measured database schema results, API response samples, and so on. The value of such tools lies in narrowing the gap between "code intent" and "runtime behavior," so that an agent's modification suggestions are based on verifiable evidence rather than the statistical inferences of a language model.
Limitations and Reality Check
Based on currently public information, there are still several aspects of tensorViz that warrant observation. Whether the forward-pass recording method is friendly to large models and how well it covers dynamic graphs are not elaborated in the materials. The maintenance and update mechanism of the 560+ model library is also unclear—paper model structures iterate quickly, and the timeliness of the library directly affects its practical value.
In addition, the actual effectiveness of agents reading graph information depends on the design quality of the retrieval interface. If an agent receives only a raw list of shapes without contextual associations, the debugging benefit may be limited. All of this requires practical use to verify.
For developers who work with PyTorch daily and also use AI coding assistants, tensorViz offers a new step worth trying: shifting the assistant from "reading code and guessing shapes" to "checking evidence and modifying code." Whether this path works depends on the refinement of the details of collaboration between the tool and agents, but the direction itself is worth watching.
One-line Summary
tensorViz provides AI coding assistants with a chain of evidence for PyTorch runtime shapes through measured forward passes.
Paragraph Summary
tensorViz is an open-source tool for AI coding assistants. Its core idea is to run a real forward pass on a PyTorch model, record the measured shapes of each module and tensor, and generate a computation graph that agents can query. Tools such as Claude Code, Codex, and Cursor can query this graph and, when debugging dimension mismatches, modify code based on evidence rather than reverse-engineering shapes from code text. The project also provides an install-free Model Explorer containing more than 560 paper model graphs. The article argues that this represents a new direction of building a runtime perception layer for agents, but dynamic graph coverage, friendliness to large models, and the timeliness of the model library still need verification.
Related articles

ChatGPT Plus Subscription Pitfall Guide: Go/Plus/Pro Tier Comparison and Quick Activation
A complete ChatGPT Plus subscription guide based on a Bilibili tutorial: from registering an account, comparing Go/Plus/Pro tiers, to the practical steps for quickly completing your subscription.

GPT-6.2 Sol/Astra Released! A Step-by-Step ChatGPT Plus Subscription Guide and Tier Comparison
GPT-6.2 Sol/Astra is out—here's a ChatGPT Plus subscription guide: register an account, compare Go/Plus/Pro tiers, and subscribe in a minute.

Comparing Three Channels for Subscribing to GPT Plus in China: Is Website Top-Up the Easiest?
How to subscribe to GPT Plus in China? This article compares website top-up, credit card, and mobile top-up channels—process, cost, and risk—with steps and tips to help you choose wisely.