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.4.tar.gz (30.2 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.4-py3-none-win_amd64.whl (412.4 kB view details)

Uploaded Python 3Windows x86-64

ztensor-0.1.4-py3-none-win32.whl (377.7 kB view details)

Uploaded Python 3Windows x86

ztensor-0.1.4-py3-none-musllinux_1_2_x86_64.whl (907.5 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

ztensor-0.1.4-py3-none-musllinux_1_2_i686.whl (937.7 kB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

ztensor-0.1.4-py3-none-musllinux_1_2_armv7l.whl (939.6 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

ztensor-0.1.4-py3-none-musllinux_1_2_aarch64.whl (886.2 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

ztensor-0.1.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (733.4 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

ztensor-0.1.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (737.5 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

ztensor-0.1.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (812.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

ztensor-0.1.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (671.4 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

ztensor-0.1.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (669.7 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

ztensor-0.1.4-py3-none-manylinux_2_5_i686.manylinux1_i686.whl (755.5 kB view details)

Uploaded Python 3manylinux: glibc 2.5+ i686

ztensor-0.1.4-py3-none-macosx_11_0_arm64.whl (546.3 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

ztensor-0.1.4-py3-none-macosx_10_12_x86_64.whl (654.4 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file ztensor-0.1.4.tar.gz.

File metadata

  • Download URL: ztensor-0.1.4.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.1

File hashes

Hashes for ztensor-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2c53d86b04baa0bbf29c98a2054e656f379414419b83607c9f97a4c87892f200
MD5 d63f45dc01bb7706214226c2b8dda303
BLAKE2b-256 e1517f514b1efb1de47f8aa7fca9f77fd5bcd2c8c49d9342215dc773725263eb

See more details on using hashes here.

File details

Details for the file ztensor-0.1.4-py3-none-win_amd64.whl.

File metadata

  • Download URL: ztensor-0.1.4-py3-none-win_amd64.whl
  • Upload date:
  • Size: 412.4 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.1

File hashes

Hashes for ztensor-0.1.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 bf7a6bf5dbb73d9b3feb717aed2c3ab5247d19164476408afdfc2b496646e8fd
MD5 2ea8b371fe87d2cf3dbaff066aae3b14
BLAKE2b-256 99012f3d4b5315b9deabc5b966881a53ae3ffc3ffe833cbffe1a21315c89f87d

See more details on using hashes here.

File details

Details for the file ztensor-0.1.4-py3-none-win32.whl.

File metadata

  • Download URL: ztensor-0.1.4-py3-none-win32.whl
  • Upload date:
  • Size: 377.7 kB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.1

File hashes

Hashes for ztensor-0.1.4-py3-none-win32.whl
Algorithm Hash digest
SHA256 0985dd547e05b00af770368dd021c6f8af1f714ecae3b3f8d67d8904d08f2280
MD5 a185f7071f671cc8da5849475c522b3d
BLAKE2b-256 c9b79531bf52e16e0d43c05de937465f7ddab5eaf99273871be58a7988992f8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e83db8f63d60a3c9496de501d1fd9d4754a51415abc1154a5c2c455dff76e6fa
MD5 6ab620be51fb5d6981b77ccbddcb9983
BLAKE2b-256 f5df48dd4cf8b36df76333f20024f1994546a7e734c087d34c89a7e19e32c4a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 a7a580c7407c71440d4cd2688cf586e988892e06de1099bb5e6318b3d45c3f15
MD5 2a7582c7c1ac94fb593e26ffec415cac
BLAKE2b-256 35c16090886214c138ac1584cac2280866512a48cb0306418b25316a5b608b89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 9d27969a92e252325b065a98b2b85421a47b608c431277088939a6d08f3e6e37
MD5 7c7405f89986e885fd72dc60d4d6959a
BLAKE2b-256 85c7b688423acf1c6f61bc7cd578eed8703ea2bda5d8d87eacae1e29ec3f3e52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 5dec0207985f8f800efaa0591bfc8de56e486f825c9939e56cfe1dcf79326cbe
MD5 0f6fa04c0029eff9937b0564ad9aa802
BLAKE2b-256 4fdfae708ef2db5d665708b92f1a50a49ec3b71f7f5ab7a899204d8a68b34d07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c49c7229bf643b0533dc8967be5ad7b018fe4f310f8c2a41b109268ec7f76e7a
MD5 3fe33b9daf4f429ddff3366c501b9d42
BLAKE2b-256 f06d22c4b04cfef7f00628e8568433bcba1263941a236ae319a8f93d5cb3673d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 371492a9f0158b8deb2b5d27736a311c72fb0272785307cef4bfad47771034df
MD5 1add9daa90d8cf4c3ddc7b4bd357d826
BLAKE2b-256 573dc1988f0961a9253d5bf9d1cb49c3fe15bd483b7df64f12fe498bdc2fbce8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 49053817979ba74529bda8efe67487149f5ac09d6a05c07e3fecba043e085bf7
MD5 af9f0467e6317ad6ac8e8284ce7bb212
BLAKE2b-256 2146660586d8cd0ad0f4e2651589e1b497bdc3fb8a0029964b83acc7ffcf892f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 73879ced98fbc2c58259d9b01c30f6c1ee6be916aada3e76cd9a6c49a5fd7314
MD5 86eb821195fd0fbb61d3ab95019be38e
BLAKE2b-256 2870ca2523449459afd9701e633cd00fb9797205c60c55aecceeb3f76f88f29a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d41ea42ef67a310cba44ec6943c17172765b4114471cc2d06e7d9c772865b476
MD5 8c58743a31268275ca6e9f75196154f9
BLAKE2b-256 fc996a1b12dee788a644b33472f63de625a9a18084c99b9693c0196b13e8117c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 0140d85e09634a676e707fadd501e7eca2bdd700c09d799f871cfa4556f73885
MD5 b340bce43d01414c0ddcc7ad0fd95eb0
BLAKE2b-256 c80bfb15e1196f3110276d95798c2693f691a233ed69c21cb3a817066b558f33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c9a288a909e728843d62645fef10c2cca186ce04c026f2c732a7f9a78939a70
MD5 259ee8f8b48966998dda326433f35013
BLAKE2b-256 44fc9638dbd419cf16e2938c6ce7da6072b9f51d0a47e66477581ab3ca2bc7e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.4-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9100cac51a2463690c9215b85558534d19d69e5fd2b0ce51772a9fa2acd8f6f0
MD5 0579cec82e4f17d0d422a2379a913d68
BLAKE2b-256 39bb4a8f730596785a43af98453b29f2dea93ba8b7b719af8f74ad783e5c1c59

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