lovely-tensors
❤️ Lovely Tensors
What it is and what it does
Lovely Tensors replaces PyTorch's default tensor repr with a compact, human-readable summary that shows shape, element count, memory footprint, value range, mean, standard deviation, and a histogram—all in one line. It detects and flags NaN, Inf, and all-zero tensors, and works with named dimensions and gradient tracking. The package monkey-patches torch.Tensor's display methods so the improved output appears automatically in notebooks and REPLs without changing your code.
It is designed for interactive debugging and exploration, not for production logging. The summary format is stable across tensor operations, making it easy to spot data anomalies during model development. It also provides optional verbose and plain-text modes, and a `.deeper` method to recursively inspect nested tensor structures.
Use it for:
- Debugging neural network activations in Jupyter notebooks without scrolling through thousands of raw values
- Quickly spotting NaN or Inf propagation during training by inspecting intermediate tensors
- Verifying tensor shapes and memory usage at a glance during model prototyping
- Inspecting gradient statistics after backpropagation to detect gradient explosion or vanishing
- Exploring multi-dimensional data (e.g., image batches) by recursively drilling into sub-tensors with `.deeper`
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Monkey-patches PyTorch tensors to display human-readable summaries with statistics, histograms, and anomaly detection instead of raw numerical dumps.
Yes. Low install friction, no security issues, permissive license, and active maintenance make it a safe addition. If you work with PyTorch in notebooks or interactive environments, the quality-of-life improvement from readable tensor summaries justifies the minimal dependency footprint. Not essential for production code, but valuable for development and debugging.
Install
lovely-tensors on PyPI
pip
pip install lovely-tensorsuv
uv add lovely-tensorspoetry
poetry add lovely-tensorsInstalling lovely-tensors
Before you install
Low friction: pure Python wheel with only torch and lovely-numpy as runtime dependencies. Active maintenance with recent releases; marked Alpha but in use across top-tier projects.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal attribution requirements.
Quickstart
pip install lovely-tensors
import lovely_tensors as lt
import torch
lt.monkey_patch()
t = torch.randn(3, 196, 196)
print(t) # Now shows: tensor[3, 196, 196] n=115248 x∈[...] μ=... σ=...
Verify before relying
- Whether monkey-patching persists across notebook restarts or requires re-import in each session
- Performance impact when working with very large tensors (gigabyte scale)
- Compatibility with custom tensor subclasses or third-party PyTorch extensions
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — torch, lovely-numpy |
| Maintenance | actively maintained — 156 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 75,939/month — #14,666 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lovely_tensors-0.1.22-py3-none-any.whl
Keywords: jupyter, pytorch, tensor, visualisation
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
lovely-numpyProvides a human-readable summary of NumPy…
permissive · top 15,000 on PyPI
torchtypingAdds type annotations for PyTorch tensor shape,…
permissive · top 15,000 on PyPI
einopsEinops provides readable tensor operations…
permissive · top 1,000 on PyPI
pytorch-seedProvides reproducible random number generation…
permissive · top 15,000 on PyPI
torchcodecTorchCodec decodes and encodes videos, audio,…
unclear · top 5,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
torchinfoGenerates detailed summaries of PyTorch neural…
permissive · top 15,000 on PyPI
torch-geometricPyTorch Geometric is a library for building and…
permissive · top 5,000 on PyPI
torchmetricsTorchmetrics provides a collection of PyTorch…
permissive · top 5,000 on PyPI
pytorchThis package is a redirect or placeholder; the…
unclear · top 15,000 on PyPI