Skip to main content

Universal tensor validation and drift detection for PyTorch (NumPy optional).

Project description

Flamehaven Tensor Canon

"Data is not just numbers; it is a structural covenant."

Flamehaven Tensor Canon is a small library for:

  • Structural validation (shapes and optional dtypes)
  • Distribution drift detection (MMD-based)

PyTorch is required. NumPy support is optional.

Installation

pip install flamehaven-tensor-canon

Enable NumPy support:

pip install flamehaven-tensor-canon[numpy]

Quick start (validation)

import torch
from tensor_canon import validate

spec = "batch channels 224 224"
data = torch.randn(32, 3, 224, 224)

validate(data, spec, key="input_layer")

Drift detection

import torch
from tensor_canon.validator import engine

torch.manual_seed(42)
golden = torch.randn(100, 5)
engine.check_drift("embeddings", golden, register_golden=True)

current = golden + torch.randn_like(golden) * 0.01
drift = engine.check_drift("embeddings", current)
print("drift:", drift)

Development

pip install -e .[dev,numpy]
ruff check .
pytest -q

Docker

docker build -t tensor-canon .
docker run --rm tensor-canon

Release notes and security

  • See CHANGELOG.md for release notes.
  • See SECURITY.md for vulnerability reporting.

License

MIT. See LICENSE.

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

flamehaven_tensor_canon-0.1.3.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

flamehaven_tensor_canon-0.1.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file flamehaven_tensor_canon-0.1.3.tar.gz.

File metadata

  • Download URL: flamehaven_tensor_canon-0.1.3.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flamehaven_tensor_canon-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5b3026be4ddb74d1089d89391a91ad14c874561cac8891203e238874a4c90273
MD5 922bd287d3fe1eb74f85c03032ed84b3
BLAKE2b-256 95170ca8a24640145052f55ac57bd0af949b1ab959eb45020cb9fa4a14ef8c05

See more details on using hashes here.

Provenance

The following attestation bundles were made for flamehaven_tensor_canon-0.1.3.tar.gz:

Publisher: pypi.yml on flamehaven01/Flamehaven-Tensor-Cannon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flamehaven_tensor_canon-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for flamehaven_tensor_canon-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5fe29f5732147fa588738dbf1c62491b311abd2933c4b7ee841f8de58db2612e
MD5 9af387b77621630471db330b9d72c502
BLAKE2b-256 f26106d2c1718c9383efe83c795a765db72541dbd876c28bc8161e83bf8b843f

See more details on using hashes here.

Provenance

The following attestation bundles were made for flamehaven_tensor_canon-0.1.3-py3-none-any.whl:

Publisher: pypi.yml on flamehaven01/Flamehaven-Tensor-Cannon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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