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.mdfor release notes. - See
SECURITY.mdfor vulnerability reporting.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b3026be4ddb74d1089d89391a91ad14c874561cac8891203e238874a4c90273
|
|
| MD5 |
922bd287d3fe1eb74f85c03032ed84b3
|
|
| BLAKE2b-256 |
95170ca8a24640145052f55ac57bd0af949b1ab959eb45020cb9fa4a14ef8c05
|
Provenance
The following attestation bundles were made for flamehaven_tensor_canon-0.1.3.tar.gz:
Publisher:
pypi.yml on flamehaven01/Flamehaven-Tensor-Cannon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flamehaven_tensor_canon-0.1.3.tar.gz -
Subject digest:
5b3026be4ddb74d1089d89391a91ad14c874561cac8891203e238874a4c90273 - Sigstore transparency entry: 774559210
- Sigstore integration time:
-
Permalink:
flamehaven01/Flamehaven-Tensor-Cannon@67427fa83fa66c7f5751974072fe1c7aa4e98db8 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/flamehaven01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@67427fa83fa66c7f5751974072fe1c7aa4e98db8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flamehaven_tensor_canon-0.1.3-py3-none-any.whl.
File metadata
- Download URL: flamehaven_tensor_canon-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fe29f5732147fa588738dbf1c62491b311abd2933c4b7ee841f8de58db2612e
|
|
| MD5 |
9af387b77621630471db330b9d72c502
|
|
| BLAKE2b-256 |
f26106d2c1718c9383efe83c795a765db72541dbd876c28bc8161e83bf8b843f
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flamehaven_tensor_canon-0.1.3-py3-none-any.whl -
Subject digest:
5fe29f5732147fa588738dbf1c62491b311abd2933c4b7ee841f8de58db2612e - Sigstore transparency entry: 774559212
- Sigstore integration time:
-
Permalink:
flamehaven01/Flamehaven-Tensor-Cannon@67427fa83fa66c7f5751974072fe1c7aa4e98db8 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/flamehaven01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@67427fa83fa66c7f5751974072fe1c7aa4e98db8 -
Trigger Event:
push
-
Statement type: