OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

Tensor Sensor

Tensor Sensor is a Python library for diagnosing matrix-algebra problems in deep-learning code. It enriches exceptions with operator and operand-shape details and can visualize tensor expressions and their sub-expression shapes.

Independent OpenViST project profile, based on linked sources.

Tensor Sensor — OpenViST project profile in AI Developer Tools & SDKs.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when a tensor or matrix expression fails with an unhelpful dimension error, or when you need to trace shapes through a more complex expression.

Who it is for

  • Developers debugging tensor dimensions in deep-learning expressions.
  • Python programmers using NumPy, PyTorch, JAX, TensorFlow, Keras or fastai.

Documented uses

  • Identify which operator and operand dimensions caused a matrix-algebra exception.
  • Visualize tensor shapes in Python expressions or inspect shapes across an expression tree.
Before you choose

Requirements & limits

The repository declares an MIT license and documents installation with pip.

  • The README names NumPy, PyTorch, JAX, TensorFlow, Keras and fastai as supported contexts.
  • AST visualization requires Graphviz's dot executable in addition to the Python library.
  • Parsing is limited to assignments and expressions; backslash continuations are unsupported.
  • Clarify may re-evaluate statements, so functions with side effects can run; concurrent calls from multiple threads are discouraged.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Install Tensor Sensor and prepare AST visualization

Install the library and, if you plan to display AST visualizations, prepare the Graphviz executable it requires.

Before you start

  • Python with pip
  • For AST visualization, the Graphviz dot executable

Steps

  1. Install the base package with the command below.

    Documented command
    pip install tensor-sensor
  2. If needed, install a framework dependency group with the command below, the command below, or the command below; the README also lists tensor-sensor[all].

    Documented command
    pip install tensor-sensor[torch]
    Documented command
    pip install tensor-sensor[tensorflow]
    Documented command
    pip install tensor-sensor[jax]
  3. For AST visualization, install Graphviz: the README gives brew install graphviz for Mac and conda install python-graphviz for Windows.

Expected outcome

The README says installation provides the `tsensor` module; Graphviz's dot executable is required for `tsensor.astviz()` displays.

Guide limitations

  • The base package installation does not install framework dependencies.
  • The README's platform instructions are specific to Mac and Windows.
  • Tensor Sensor parses assignments and expressions; it cannot handle backslash continuations.
Source-based practical guide

Add shape context around a tensor expression

Use the documented `clarify` context to obtain shape-aware diagnostics for an expression.

Before you start

  • Tensor Sensor installed as tsensor
  • A Python expression using a named tensor context such as NumPy

Steps

  1. Define the tensors used by the expression.

  2. Place the expression in a with tsensor.clarify() as c: block, as in the README's Y = W @ X.T + b example.

  3. Inspect the resulting visualization or augmented exception for operator and operand-shape information.

Expected outcome

The README example shows an augmented matrix-multiplication error identifying the operator and the shapes of its operands.

Guide limitations

  • The routines parse assignments or expressions and do not handle a one-line function body in the shown form.
  • Statements may be re-evaluated, so functions with side effects can run.
  • Do not call clarify() from multiple Python threads.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
6 November 2026
Original website title
parrt/tensor-sensor · Official homepage title · retained in its source language