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.1.tar.gz (27.1 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.1-py3-none-win_amd64.whl (404.3 kB view details)

Uploaded Python 3Windows x86-64

ztensor-0.1.1-py3-none-win32.whl (368.1 kB view details)

Uploaded Python 3Windows x86

ztensor-0.1.1-py3-none-musllinux_1_2_x86_64.whl (897.6 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

ztensor-0.1.1-py3-none-musllinux_1_2_i686.whl (928.7 kB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

ztensor-0.1.1-py3-none-musllinux_1_2_armv7l.whl (930.9 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

ztensor-0.1.1-py3-none-musllinux_1_2_aarch64.whl (882.8 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

ztensor-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (723.6 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

ztensor-0.1.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (732.7 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

ztensor-0.1.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (800.8 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

ztensor-0.1.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (659.0 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

ztensor-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (665.1 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

ztensor-0.1.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl (746.7 kB view details)

Uploaded Python 3manylinux: glibc 2.5+ i686

ztensor-0.1.1-py3-none-macosx_11_0_arm64.whl (536.5 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

ztensor-0.1.1-py3-none-macosx_10_12_x86_64.whl (646.5 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for ztensor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 539ab9edcd2c7a86e2bb17a161acb84117bd469a9e5aafd87649529f57c2cda2
MD5 2a3c632cdc8e316f5632d5df088cf94d
BLAKE2b-256 d66e6c896963d54ce3749e2ad665a9d3eb953399e11f63ef890f72fc2ac1d6f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ztensor-0.1.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 404.3 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.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b77453e33744b878d58b961745ace98b35daa330d56b34b1ddc2dde1ee62cf3b
MD5 11e4f325443adc0c7684053a173aeb2b
BLAKE2b-256 c67f8551dab5077d84ceaa6ef2f1ddba54bc10523aa81b5c63864d298b2959bd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ztensor-0.1.1-py3-none-win32.whl
Algorithm Hash digest
SHA256 21e3b9214d08836d72134719c27254eba4868dd058f371bf38c4b81e6346e542
MD5 b84bc6a8bfa11f6e3418270fe06e18e7
BLAKE2b-256 6013831439af213ca1ac9cb471b3f03a381c6e7f4664c05b3363b8512a3ee3c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fc1150025e0963781e31e5bc559a4a5f2d6099fdeb302c311e6d0516c7afb481
MD5 be5f9691276c373a672d994030dce855
BLAKE2b-256 938309a62ffd9cc95e0a469b40402fba5b8bd35c0bba734d64502f14ba404799

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 7b8375d9363cca38c272acc70e715b1c2a3295922a3dbc9ada6c1c8376eebed6
MD5 2de1c994f89129994d86d2e9d71faba4
BLAKE2b-256 dddad35c2a1342e7bfd45cbc3f37e92a8d278ea8fab8826879c5ef3ac7c5780c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 9855976e313489114eb5ca2f78d62d9e094242e239df2ca816d286076be70da9
MD5 d858192dc3407824b668991983ad1ab5
BLAKE2b-256 a2b7beb08e65e6508a4d96d057a46513c29683e7dc2acae5e2e567120c5d6f52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 63fee094400aec74a2504cc8cf47996a2f6cd0592567424a617d73b143daa038
MD5 97f85a8e2e273189c27efb364ec367ef
BLAKE2b-256 7394f2d451dcfc9f5cf3e64be826cdb855dc2b876eb13f1eb94d23ac65c7e04a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a43473c1f673fe65192f813f30acc36c1f9c6b1d6ea34eac09b10d4dd3eb5bb5
MD5 f4fac8820cb44284d6aa7b1ebec56325
BLAKE2b-256 f4c69d06c6b763d1f5ad1a6920dd0bec40a141078d2406a4fc07b92a5bfc0d23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 a958005b1a83ce400e41fd21ae5242e0697b4b5ada6799751c86d8223ad73705
MD5 d22ffe4e705610987b4b74be59adeb4a
BLAKE2b-256 4beb4b924ff14ef524d4f272ddf7120dba1073e830f18010682914c243c81596

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 de21108c361a4e043dc18c0bb6361a2efaa9c0e925bbc0e60a9ebc9ef7da39d4
MD5 dd8fe711860be73e97d0f5aad0058c0d
BLAKE2b-256 a5d2dedebfdf7e99e20846a734b880f70505d421dedfdd26c2ee5453f42b9142

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 a7a35ce9c11de05bf50eb33667cd573a12b083feb5b2df5c8c685513ca48cca9
MD5 362f179ddff49f8ff6d750d4aaac690b
BLAKE2b-256 bfcb7c73da87009f462125a3ca5307ec668c14d31ab0e34412d8a95fd99a0c94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a3c264f74dbb5e36104d9f4b509f2af861ffaf7379d433d707398caabb56b469
MD5 0484d354892520b52488082b639aaf1e
BLAKE2b-256 9353f26d557ff24c746f3ca36ec5830869d9cc6e523fc07c12a376c77fa60507

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 a86b510e6e9eb26ff4f1ba6f87f8210f191b1f78226c3d81c397dc5794398030
MD5 e7b333703f2ed70cd8235003f0c22c38
BLAKE2b-256 93d134fde55da92f767af88a12d25c779393f279f4e37f392eb4de186270b1c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3aa31759255fd3be612dce1cf3d96ca53ccc00aa548ef802c1522c25c52b7993
MD5 42083457406dd45e89aa8e4216ed6179
BLAKE2b-256 76ce2fab0df9f745c7a8ed4fa8eea3c1e4e803b441d79b42f5609e088635bf86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ztensor-0.1.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1c67edbf95432f36d75c702adfe36bef228f4f666df6d9699d6e82d485b1bb8f
MD5 821fd9d967cbed66a63d36d2c6d9b20e
BLAKE2b-256 d2f01f3165eda1cc95124bae98f721404d42d117474769adea95dbc58e87e341

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