Skip to main content

tensi

tensi sees your tensors.
Hover any PyTorch tensor and see its shape, with every dimension named.

tensi showing named tensor shapes in nanoGPT

Install: search tensi in VS Code's Extensions view, open a PyTorch project, hover a tensor.

Install

VS Code: install tensi from the Marketplace and open a PyTorch project. It uses the project's own .venv (what uv sync makes; else the Python extension's interpreter), and if tensi isn't there yet it offers to install it with one click: uv add --dev tensi-shapes in a uv project, else into the project's environment. Switching projects or running uv sync restarts it by itself. It runs beside Pylance and only adds shapes; the status bar shows when it is working out a file.

Command line, CI, other editors:

uv add --dev tensi-shapes      # or: pip install tensi-shapes, into the project's environment
uv tool install tensi-shapes   # or once for all projects; it reads torch from each project's .venv
tensi doctor                   # checks Pyrefly, the stubs and the interpreter Pyrefly picks, with one real probe

The package is tensi-shapes on PyPI; the command and the import are tensi. It brings Pyrefly 1.5.0 and its torch shape stubs; your project needs torch installed.

Any editor that speaks LSP can run tensi lsp as a language server for Python files. Python 3.10+, einops included.

Try it

$ tensi peek model.py
tensi peek v0.3.3  model.py  2.0s

  CausalSelfAttention.forward
    56  q, k, v   [b, t, n_embd]
    57  k         [b, n_head, t, n_embd // n_head]
    67  att       [b, n_head, t, t]
    72  y         [b, t, n_embd]
  MLP.forward
    88  x         [b, t, 4 * n_embd]
  GPT.forward
   177  tok_emb   [b, t, n_embd]
   178  pos_emb   [t, n_embd]
   186  logits    [b, t, vocab_size]
  GPT.generate
   321  v, _      [b, int]
   326  idx_next  [b, 1]

  37 tensors, 32 fully named
$ tensi check model.py
tensi check v0.3.3  model.py  2.0s
  ok no shape errors

$ tensi check bad.py
tensi check v0.3.3  bad.py  819ms
  x bad.py:17:9  Argument `Tensor[[b, 7, v]]` is not assignable to parameter `x` with type `Tensor[[b, 7, d]]` in function `Block.forward`
  x bad.py:18:9  `@` is not supported between `Tensor[[b, d]]` and `Tensor[[v, 3]]`

  2 shape errors

tensi check src/ checks every Python file under a folder and exits 1 when it finds a shape error, so it can gate CI.

Contributing

See CONTRIBUTING.md for the development setup, tests and releases.

tensi is built on Pyrefly (MIT) and its torch stubs. The mascot is a small tensor that is very good at looking.

Metadata

Release files for tensi-shapes 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tensi-shapes 0.3.3
File Size Uploaded Provenance Actions
tensi_shapes-0.3.3.tar.gz 91.6 kB With provenance Details for tensi_shapes-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tensi-shapes 0.3.3
File Interpreter ABI Platform Actions
tensi_shapes-0.3.3-py3-none-any.whl Python 3 none any Details for tensi_shapes-0.3.3-py3-none-any.whl

Total release size: 172.6 kB

Release files / tensi_shapes-0.3.3.tar.gz

Download URL tensi_shapes-0.3.3.tar.gz
Size 91.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c80ea262af96ef770ee279b901ae7713eeccf7a8c8346f29c3eacfce8e5c9412
BLAKE2b-256 checksum
How to use checksums
37afcb98e1a0b81ce287ed3a5061c9b2046ce6ff38e4d288e444ce16cb412ce9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / tensi_shapes-0.3.3-py3-none-any.whl

Download URL tensi_shapes-0.3.3-py3-none-any.whl
Size 81.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f803c11e2d1fc4f90d2e851967006b6d5edc1b92d5c7a13f2b0f690d87a3922
BLAKE2b-256 checksum
How to use checksums
7a1ae24de35df95782fb5e07498d357c5fb31d8b9a52bf13da3b12ed6967682b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for tensi-shapes 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tensi_shapes-0.3.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page