Skip to main content

Hologram Python SDK

The Python package exposes a chainable graph builder on top of the stable hologram-ffi source-builder ABI. Wheels build and bundle the Rust hologram-ffi cdylib; hologram._hologram loads that library and implements the SDK NativeBinding protocol.

import hologram as hg

g = hg.Graph("encoder")
x = g.input("x", dtype=hg.f32, shape=[2, 3])
w = g.const_ref("w", dtype=hg.f32, shape=[3, 2], file="weights.bin", blake3="0" * 64)
y = x.matmul(w, shape=[2, 2]).relu()
archive = g.output("y", y).compile()

with hg.Session.load(archive) as session:
    assert session.input_dtype(0) == hg.f32
    assert session.output_dtype(0) == hg.f32
    assert session.extension("missing") is None
    outputs = session.execute({"x": input_bytes})
    y_bytes = outputs["y"]

Native Hologram .txt source can be compiled without constructing a Graph object:

archive = hg.compile_source("input x :1\nop relu x :1 as=y\noutput y\n")
archive = hg.compile_source_file("graph.txt")

Native and SDK-side failures raise typed hg.HologramError subclasses with a stable .code field:

try:
    hg.Session.load(b"not-a-holo")
except hg.ArchiveLoadError as exc:
    assert exc.code == 7

When the native compiler can locate source position, errors also expose .line, .column, and .rejected:

try:
    bad = hg.Graph("bad")
    w = bad.const_ref("w", shape=[1], file="weights.bin", blake3="not-hex")
    bad.output("w", w).compile()
except hg.ExternalTensorError as exc:
    print(exc.code, exc.line, exc.column, exc.rejected)

The public error classes are ParseError, GraphError, UnsupportedOpError, UnknownOpError, BadAttrError, ShapeError, ExternalTensorError, ArchiveLoadError, ExecutionError, AbiMismatchError, InvalidArgumentError, UnsupportedDTypeError, and CompileError.

compile() requires a native binding module that implements the SDK NativeBinding protocol. Tests can pass a fake binding directly:

archive = g.output("y", y).compile(native=my_binding)

const_ref is compile-time only. The native compiler reads the declared file range, verifies the BLAKE3 digest, and embeds the bytes into the archive before Session.load(...). Set HOLOGRAM_EXTERNAL_TENSOR_ROOT to force all resolved external tensor paths under an explicit compile root.

Build a local wheel from the repository root:

python3 -m pip wheel sdk/python --no-deps -w /tmp/hologram-wheel
python3 -m pip install /tmp/hologram-wheel/*.whl
python3 sdk/python/scripts/smoke-installed.py

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

uor_hologram-0.12.1-py3-none-win_amd64.whl (458.4 kB view details)

Uploaded Python 3Windows x86-64

uor_hologram-0.12.1-py3-none-manylinux_2_28_x86_64.whl (606.3 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

uor_hologram-0.12.1-py3-none-macosx_11_0_x86_64.whl (565.2 kB view details)

Uploaded Python 3macOS 11.0+ x86-64

uor_hologram-0.12.1-py3-none-macosx_11_0_arm64.whl (520.4 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file uor_hologram-0.12.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: uor_hologram-0.12.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 458.4 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for uor_hologram-0.12.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 885ff03c158cced57aaba516ddafa8a9b3e199fd12bf19ae25612de54240d8d7
MD5 229aa51b4f65b3f26706a912484929ac
BLAKE2b-256 8cfc686e8f43097db446697d52d4d9fbff792c53cf8be6c4f28a2c65fa8c8fa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_hologram-0.12.1-py3-none-win_amd64.whl:

Publisher: publish-pypi.yml on Hologram-Technologies/hologram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uor_hologram-0.12.1-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for uor_hologram-0.12.1-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e7a0024809ab1e3c5fa3495ddff2b9234db87cd7986b52202f5829acf6dc027c
MD5 a771edf30828597fb5d4384da7308a86
BLAKE2b-256 554e7e61091d8ba38e3506def2db789fb209e6ba22003a408f46ec7cde5df0cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_hologram-0.12.1-py3-none-manylinux_2_28_x86_64.whl:

Publisher: publish-pypi.yml on Hologram-Technologies/hologram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uor_hologram-0.12.1-py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for uor_hologram-0.12.1-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e8c8a69aec47556c2e70b6f3ea7d2dcbf033437e42819e23f152d7a3fd949395
MD5 2337683d31f2aaaefe7169dc96a8f546
BLAKE2b-256 2ea402e42d9ffcbf881164bb445034deaf5b62e51d72a4df6619e6f7b714507a

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_hologram-0.12.1-py3-none-macosx_11_0_x86_64.whl:

Publisher: publish-pypi.yml on Hologram-Technologies/hologram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uor_hologram-0.12.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for uor_hologram-0.12.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 315998394bc3c03c31fa3a03525193d3874259a3bbcda9c65d45f1894a936dfd
MD5 f3fa9f1615cbb0f4a440646151fb7346
BLAKE2b-256 f706590f5f1406e73e443ef38cbd5af6534e670ba55a0b6823a15c84fd97232d

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_hologram-0.12.1-py3-none-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on Hologram-Technologies/hologram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.12.1 This release

4 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page