Skip to main content

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, bfloat16
  • int64, int32, int16, int8
  • uint64, uint32, uint16, uint8
  • bool

Supported Encodings (encoding)

  • raw: Direct binary dump of tensor elements (with data_endianness if multi-byte).
  • zstd: Zstandard-compressed data. size is compressed size.

Layouts

  • dense (default): Standard contiguous tensor data.
  • sparse: Data is stored in a sparse format. The metadata map must include a sparse_format field (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:

  1. Read the last 8 bytes for the CBOR array size.
  2. 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, and layout values 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-byte dtype, data is little-endian unless data_endianness is specified.
  • For sparse tensors, the metadata must fully describe the sparse structure.

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

ztensor-0.1.2.tar.gz (27.6 kB view details)

Uploaded Source

Built Distributions

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

ztensor-0.1.2-py3-none-win_amd64.whl (404.8 kB view details)

Uploaded Python 3Windows x86-64

ztensor-0.1.2-py3-none-win32.whl (368.5 kB view details)

Uploaded Python 3Windows x86

ztensor-0.1.2-py3-none-musllinux_1_2_x86_64.whl (898.1 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

ztensor-0.1.2-py3-none-musllinux_1_2_i686.whl (929.2 kB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

ztensor-0.1.2-py3-none-musllinux_1_2_armv7l.whl (931.3 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

ztensor-0.1.2-py3-none-musllinux_1_2_aarch64.whl (883.2 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

ztensor-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (724.1 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

ztensor-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (733.2 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

ztensor-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (801.2 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

ztensor-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (659.4 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

ztensor-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (665.5 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

ztensor-0.1.2-py3-none-manylinux_2_5_i686.manylinux1_i686.whl (747.2 kB view details)

Uploaded Python 3manylinux: glibc 2.5+ i686

ztensor-0.1.2-py3-none-macosx_11_0_arm64.whl (537.0 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

ztensor-0.1.2-py3-none-macosx_10_12_x86_64.whl (646.9 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

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

Hashes for ztensor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 61b2d87db27d93e2a2226d58aca4d476dd9051d43c539ff390f3c68574dcd8d6
MD5 a571000cfa1e05e5f52069f04fcbbcb1
BLAKE2b-256 7cb510a116ceaf6d789b69984269a73f2f279b76d57acaa5e48bb2cc7922a338

See more details on using hashes here.

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

Hashes for ztensor-0.1.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 49e9426a3fd4de9bd23c97db869663e147fe84789b5350ba27d02df4f29fa05f
MD5 bad108248c8321fdc3b2679680981265
BLAKE2b-256 b158209f4fa806bd5f6ccb254b816aaee6652e9fbb5aafd87351caa48c9d7f14

See more details on using hashes here.

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

Hashes for ztensor-0.1.2-py3-none-win32.whl
Algorithm Hash digest
SHA256 1acd358341f0bb3f077ca1250d675ae4a989a6cad556d0521487129f51af31b1
MD5 93a4e1ea9df0329b305e849e109261a8
BLAKE2b-256 35dd9672cc50a2c4e5d98e1ea06200ccfa11dc63d57a061a4eebc5a27ddd717b

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 41d4e9e1d4f23b5d9aae2e9b14c0186c54db0c1ed7c0261d4bbdecd64031f10c
MD5 18cb4f96fcfed5b68a3114ea348adda3
BLAKE2b-256 d635214f83e072336e0e8f8710d22d82c94a824df8d0918a082f2c02c919bd1c

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 fbb82fd82102d964b2f9496c46f3764f78e1b6aedee3a0a5a0dc6589fdd5c97c
MD5 ce12bbcdecd2906f2d7c3010ea46736b
BLAKE2b-256 3b8c9d18feaa1553ae2f6b98c63f5958670310ed93838292bb6bb520391d6cee

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 a5b5df8ac95fe0afd830695c50b75ed345247225bddea5f7f6c11bd05ca87f13
MD5 d9a22f4c63396f5e6a8eada3466b53a4
BLAKE2b-256 290627d39635d0b41fccb3af856b85d55a29fe6ce1dd821b358c7b4e5d11b795

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 1521dc6d6df05ebdb3618c1e80b23c572fa5d712cbd063630a7948023391a55a
MD5 18378f73abd2d70070fda11749549fed
BLAKE2b-256 bc1c6fe2fb1d91834f4771529486657cfdbcaa67ed70e857a30686e58a7c66b7

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aece4b5cfc47ad56f7facd6c8759d69ae745168d9a6ef80d0396c13c4b6fe53a
MD5 af8651882fe823fc1278ba56513410ab
BLAKE2b-256 12486494d2a828b58477ead29166fc940c94120db8ce9a2da46e211b8b16ee3d

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 f26c3621c091ea7c69083306767a3204268d7ce99f6db09df4d527750cd4a89b
MD5 f7abfcb681e9b9902ba72878713bdbba
BLAKE2b-256 b2c76157fb53ee42bcbbe7f6d43f9b82caf767753934a0bc79b097306b619e22

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 85446de13e97f0c1ee69504bbcbc9d064826c2d3818e36ffbdb376a28db68a6f
MD5 35a8b2997374d55c17166323967ef381
BLAKE2b-256 c96630ffc13fbcccf243ac42b52c9fd504f7113cd499b833f366b1ca737b1fca

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 b0dabcdcf00301930fff8b4be129f2a0c5f2b2ae657bd17b306245797d80409f
MD5 68626585c82b5cdd97bace87bc1ad08c
BLAKE2b-256 302218c55af57cf7340452c6842700f7d2d6e97b62a115dc7d779092ff8c10ad

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f9d7336c5c0ff169ee4be3030f129cc82446722101d071a4fff13758620bb109
MD5 dc8863bd8f431b727ae8baf26ee8e187
BLAKE2b-256 e47bf7bd29d7c13a9604039e780d52288a636a5b12a44643239c9844a1881ea5

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 70fae41e74674ca856e35a93c17595339c73941e4cf5c2595175521dd65456dd
MD5 3afb81c02c5c1eb8ce5b9a7b9f6d3316
BLAKE2b-256 8374be894f9b286f7384c07ce67f8bc813dc4ac13f3cb48e5f4f98cbecada8b0

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a865397973e9e0dae5eed9cb372a244901e54940a5bfdffa335316043b4c7ff6
MD5 c5a092ca67b7db97b1ef8f715041e510
BLAKE2b-256 52d924169366767f88f051e6f958963697a7556078b4a0f33d4876f4f798f23c

See more details on using hashes here.

File details

Details for the file ztensor-0.1.2-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ztensor-0.1.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1574967f66a28b52465c7d37ce3e7f28ace894e0c8c075b37953cda52449b68e
MD5 ae76714f531d7db7337f7382ba69611c
BLAKE2b-256 8a8f87cd41d951a3e025b050bb5a30235a09a383db94e51e076ead4438c7397f

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