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-0.3.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-0.3.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tensi-0.3.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-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e1ee50c1e25235f9f6e034a7805483e2754370839a0d36d6fb2cf1aee2273126
MD5 89bd8766a4e922dc8d9e23fca0ca78d2
BLAKE2b-256 f5ad26f6db015bef477de2f2f5f098112d69e274430f39b16a1f061e17c5dd0b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tensi-0.3.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-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75e77c1183e90ea95db82c9b808a78c714f17dfc9f1d018857c7534f9470ee46
MD5 a81d4c94fa0982fa8b971018c14897a8
BLAKE2b-256 f7729a04826ddc159a5893cfb47637173e80918ebc53a6fc0de3300c91059166

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