Python bindings for the zTensor library.
Project description
zTensor File Format
Version 0.1.0
zTensor is a binary format for storing large multi-dimensional arrays (tensors), designed for efficient, safe, and flexible access. It supports raw and compressed (zstd) encodings, quantized and sparse layouts, and is extensible.
For dense tensors stored with encoding: "raw" and matching endianness, zTensor enables zero-copy access to tensor data.
File Layout
+-------------------------------+
| Magic Number (8 bytes) |
+-------------------------------+
| Tensor Blob 0 (aligned) |
+-------------------------------+
| Padding (if needed) |
+-------------------------------+
| Tensor Blob 1 (aligned) |
+-------------------------------+
| ... |
+-------------------------------+
| CBOR Metadata Array |
+-------------------------------+
| CBOR Array Size (8 bytes) |
+-------------------------------+
- Magic Number: ASCII "ZTEN0001" at offset 0.
- Tensor Blobs: Each tensor's data, starting at a 64-byte aligned offset. No per-blob headers. Padding (undefined value, usually zero) is inserted as needed.
- CBOR Metadata Array: At the end of the file, a CBOR-encoded array of metadata maps (one per tensor).
- CBOR Array Size: Last 8 bytes, little-endian uint64, gives the size of the CBOR array.
Tensor Metadata (CBOR Map)
Each tensor's metadata is a CBOR map with these required fields:
name(string): Tensor name.offset(uint64): Absolute file offset to tensor data (multiple of 64).size(uint64): On-disk size in bytes (compressed if applicable).dtype(string): Data type (see below).shape(array): Array of dimensions (empty for scalar).encoding(string): Data encoding (see below).layout(string): "dense" (default) or "sparse". For sparse, see below.
Optional fields:
data_endianness(string): "little" or "big" (default: little, for raw multi-byte types).checksum(string): e.g., "crc32c:0x1234ABCD" or "sha256:...".- Custom fields are allowed; unknown keys are ignored by readers.
Supported Data Types (dtype)
float64,float32,float16,bfloat16int64,int32,int16,int8uint64,uint32,uint16,uint8bool
Supported Encodings (encoding)
raw: Direct binary dump of tensor elements (withdata_endiannessif multi-byte).zstd: Zstandard-compressed data.sizeis compressed size.
Layouts
dense(default): Standard contiguous tensor data.sparse: Data is stored in a sparse format. The metadata map must include asparse_formatfield (e.g., "csr", "coo") and any additional fields required to describe the sparse structure (such as index arrays, indptr, etc.).
Index Reading
To read the index:
- Read the last 8 bytes for the CBOR array size.
- Seek backwards by that amount to read the CBOR metadata array.
As a result, the start offset of the metadata is: (file size) - (size of the metadata) - (8 byte).
Zero-Tensor Files
A valid zTensor file may contain zero tensors:
- 8 bytes magic, 1 byte empty CBOR array (
0x80), 8 bytes size (0x01...00). - Total: 17 bytes.
Extensibility
- New
dtype,encoding, andlayoutvalues may be added in future versions. - Custom metadata fields are allowed; unknown fields are ignored.
Notes
- All offsets are absolute and account for the 8-byte magic number.
- All tensor data blobs are 64-byte aligned.
- No per-blob headers; all metadata is in the CBOR array at the end of the file.
- For
encoding: "raw"and multi-bytedtype, data is little-endian unlessdata_endiannessis specified. - For sparse tensors, the metadata must fully describe the sparse structure.
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 Distributions
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 ztensor-0.1.2.tar.gz.
File metadata
- Download URL: ztensor-0.1.2.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61b2d87db27d93e2a2226d58aca4d476dd9051d43c539ff390f3c68574dcd8d6
|
|
| MD5 |
a571000cfa1e05e5f52069f04fcbbcb1
|
|
| BLAKE2b-256 |
7cb510a116ceaf6d789b69984269a73f2f279b76d57acaa5e48bb2cc7922a338
|
File details
Details for the file ztensor-0.1.2-py3-none-win_amd64.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-win_amd64.whl
- Upload date:
- Size: 404.8 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49e9426a3fd4de9bd23c97db869663e147fe84789b5350ba27d02df4f29fa05f
|
|
| MD5 |
bad108248c8321fdc3b2679680981265
|
|
| BLAKE2b-256 |
b158209f4fa806bd5f6ccb254b816aaee6652e9fbb5aafd87351caa48c9d7f14
|
File details
Details for the file ztensor-0.1.2-py3-none-win32.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-win32.whl
- Upload date:
- Size: 368.5 kB
- Tags: Python 3, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1acd358341f0bb3f077ca1250d675ae4a989a6cad556d0521487129f51af31b1
|
|
| MD5 |
93a4e1ea9df0329b305e849e109261a8
|
|
| BLAKE2b-256 |
35dd9672cc50a2c4e5d98e1ea06200ccfa11dc63d57a061a4eebc5a27ddd717b
|
File details
Details for the file ztensor-0.1.2-py3-none-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 898.1 kB
- Tags: Python 3, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41d4e9e1d4f23b5d9aae2e9b14c0186c54db0c1ed7c0261d4bbdecd64031f10c
|
|
| MD5 |
18cb4f96fcfed5b68a3114ea348adda3
|
|
| BLAKE2b-256 |
d635214f83e072336e0e8f8710d22d82c94a824df8d0918a082f2c02c919bd1c
|
File details
Details for the file ztensor-0.1.2-py3-none-musllinux_1_2_i686.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-musllinux_1_2_i686.whl
- Upload date:
- Size: 929.2 kB
- Tags: Python 3, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbb82fd82102d964b2f9496c46f3764f78e1b6aedee3a0a5a0dc6589fdd5c97c
|
|
| MD5 |
ce12bbcdecd2906f2d7c3010ea46736b
|
|
| BLAKE2b-256 |
3b8c9d18feaa1553ae2f6b98c63f5958670310ed93838292bb6bb520391d6cee
|
File details
Details for the file ztensor-0.1.2-py3-none-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 931.3 kB
- Tags: Python 3, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5b5df8ac95fe0afd830695c50b75ed345247225bddea5f7f6c11bd05ca87f13
|
|
| MD5 |
d9a22f4c63396f5e6a8eada3466b53a4
|
|
| BLAKE2b-256 |
290627d39635d0b41fccb3af856b85d55a29fe6ce1dd821b358c7b4e5d11b795
|
File details
Details for the file ztensor-0.1.2-py3-none-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 883.2 kB
- Tags: Python 3, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1521dc6d6df05ebdb3618c1e80b23c572fa5d712cbd063630a7948023391a55a
|
|
| MD5 |
18378f73abd2d70070fda11749549fed
|
|
| BLAKE2b-256 |
bc1c6fe2fb1d91834f4771529486657cfdbcaa67ed70e857a30686e58a7c66b7
|
File details
Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 724.1 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aece4b5cfc47ad56f7facd6c8759d69ae745168d9a6ef80d0396c13c4b6fe53a
|
|
| MD5 |
af8651882fe823fc1278ba56513410ab
|
|
| BLAKE2b-256 |
12486494d2a828b58477ead29166fc940c94120db8ce9a2da46e211b8b16ee3d
|
File details
Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 733.2 kB
- Tags: Python 3, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f26c3621c091ea7c69083306767a3204268d7ce99f6db09df4d527750cd4a89b
|
|
| MD5 |
f7abfcb681e9b9902ba72878713bdbba
|
|
| BLAKE2b-256 |
b2c76157fb53ee42bcbbe7f6d43f9b82caf767753934a0bc79b097306b619e22
|
File details
Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 801.2 kB
- Tags: Python 3, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85446de13e97f0c1ee69504bbcbc9d064826c2d3818e36ffbdb376a28db68a6f
|
|
| MD5 |
35a8b2997374d55c17166323967ef381
|
|
| BLAKE2b-256 |
c96630ffc13fbcccf243ac42b52c9fd504f7113cd499b833f366b1ca737b1fca
|
File details
Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 659.4 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0dabcdcf00301930fff8b4be129f2a0c5f2b2ae657bd17b306245797d80409f
|
|
| MD5 |
68626585c82b5cdd97bace87bc1ad08c
|
|
| BLAKE2b-256 |
302218c55af57cf7340452c6842700f7d2d6e97b62a115dc7d779092ff8c10ad
|
File details
Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 665.5 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9d7336c5c0ff169ee4be3030f129cc82446722101d071a4fff13758620bb109
|
|
| MD5 |
dc8863bd8f431b727ae8baf26ee8e187
|
|
| BLAKE2b-256 |
e47bf7bd29d7c13a9604039e780d52288a636a5b12a44643239c9844a1881ea5
|
File details
Details for the file ztensor-0.1.2-py3-none-manylinux_2_5_i686.manylinux1_i686.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
- Upload date:
- Size: 747.2 kB
- Tags: Python 3, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70fae41e74674ca856e35a93c17595339c73941e4cf5c2595175521dd65456dd
|
|
| MD5 |
3afb81c02c5c1eb8ce5b9a7b9f6d3316
|
|
| BLAKE2b-256 |
8374be894f9b286f7384c07ce67f8bc813dc4ac13f3cb48e5f4f98cbecada8b0
|
File details
Details for the file ztensor-0.1.2-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 537.0 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a865397973e9e0dae5eed9cb372a244901e54940a5bfdffa335316043b4c7ff6
|
|
| MD5 |
c5a092ca67b7db97b1ef8f715041e510
|
|
| BLAKE2b-256 |
52d924169366767f88f051e6f958963697a7556078b4a0f33d4876f4f798f23c
|
File details
Details for the file ztensor-0.1.2-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: ztensor-0.1.2-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 646.9 kB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1574967f66a28b52465c7d37ce3e7f28ace894e0c8c075b37953cda52449b68e
|
|
| MD5 |
ae76714f531d7db7337f7382ba69611c
|
|
| BLAKE2b-256 |
8a8f87cd41d951a3e025b050bb5a30235a09a383db94e51e076ead4438c7397f
|