Skip to main content

Interactive tensor shape visualization library

Project description

Tensi

Interactive tensor shape visualization

Tensi turns multi‑dimensional tensors into intuitive, interactive geometry so you can instantly see what your data looks like.

I built Tensi while wrangling distributed sharding‑and‑concatenation of latent tensors. Interactive geometric visuals of tensor shapes finally made the process make sense.

Installation

pip install tensi

Quick Start

import tensi
import torch

# Visualize a 3D tensor
tensor = torch.randn(2, 4, 5)  # [Batch, Rows, Cols]
fig = tensi.visualize(tensor)
fig.show()

Usage Examples

Basic Usage

import tensi
import torch
import numpy as np

# Using the quick visualize function
tensor = torch.randn(3, 4, 5)
fig = tensi.visualize(tensor, title="My Tensor")
fig.show()

# Using different data types
data = [[1, 2, 3], [4, 5, 6]]
fig = tensi.visualize(data, dtype="int32")
fig.show()

# Using numpy arrays
np_array = np.random.rand(2, 3, 4)
fig = tensi.visualize(np_array, dtype="float64")
fig.show()

Tensor Shapes

# 2D Tensor
tensor_2d = torch.randn(5, 7)  # [Rows, Cols]
fig = tensi.visualize(tensor_2d, title="2D Tensor")
fig.show()

# 3D Tensor
tensor_3d = torch.randn(3, 5, 7)  # [Batch, Rows, Cols]
fig = tensi.visualize(tensor_3d, title="3D Tensor - 3 Batches")
fig.show()

# 4D Tensor
tensor_4d = torch.randn(2, 4, 5, 6)  # [Batch, Width, Height, Depth]
fig = tensi.visualize(tensor_4d, title="4D Tensor - 2 Batches")
fig.show()

Save Visualizations

# Save as interactive HTML
fig = tensi.visualize(tensor)
fig.write_html("tensor_visualization.html")

# Save as static image (requires kaleido)
fig.write_image("tensor_visualization.png")

Requirements

  • Python >= 3.7
  • PyTorch >= 1.8.0
  • NumPy >= 1.19.0
  • Plotly >= 5.0.0

Contributing

Contributions are welcome! Please feel free to submit a PR.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tensi-1.0.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tensi-1.0.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file tensi-1.0.0.tar.gz.

File metadata

  • Download URL: tensi-1.0.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for tensi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 009916d97cddf821cfdf73828e4a978c1fda365ccdefe0c6921ab435bfb6b075
MD5 c7fbe69ea3df9743a337e69b69db5cec
BLAKE2b-256 04075eb09d52722f9fab356c804055ba57ea8b1ded170f1da48845ac58ce4a76

See more details on using hashes here.

File details

Details for the file tensi-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tensi-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for tensi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 292e1ae4c4d015657756c5bb3a67e5b702112475360ed2e8b301e1fb43a0922f
MD5 e86603e5ab489e5f394423ab8d245d82
BLAKE2b-256 1af9e781a12f21311bb8113b160c9a471e8f0d7edfbaad4bdd587d8954bdf3f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page