--- id: lovely-tensors version: "0.1.22" license: MIT license_treatment: permissive maintenance: active --- # lovely-tensors — ❤️ Lovely Tensors License: permissive · Maintenance: active · Downloads: 75.9K/mo ## 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 above — 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 pip install lovely-tensors uv add lovely-tensors poetry add lovely-tensors ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 75.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytorch tensor visualization, torch tensor debugging, tensor summary statistics, pytorch repr improvement, tensor inspection tool, pytorch-debugging, jupyter-friendly, tensor-inspection [View on SkillFed](https://skillfed.io/packages/lovely-tensors) · [View on PyPI](https://pypi.org/project/lovely-tensors/)