A lightweight Rust library for running Keras models without the TensorFlow stack.
Binary size: ~450 KB · Designed for resource-constrained environments
Features
| Category | Supported |
|---|---|
| Layers | Dense, Conv2D, Flatten, MaxPooling2D, AveragePooling2D, Dropout, BatchNormalization |
| Activations | ReLU, Softmax, Sigmoid, Tanh, Linear |
| Formats | .keras, .h5 |
Installation
pip install pocket-inference
Prebuilt wheels are published for Linux (x86_64, aarch64) and macOS (Apple Silicon), and cover every Python version from 3.7 onwards via the stable ABI.
Usage
import numpy as np
from pocket_inference import Sequential
# Load a saved Keras model
model = Sequential.load("model.keras")
# Run inference on a single sample
input_data = np.array([[1.0, 2.0, 3.0, 4.0]], dtype=np.float32)
output = model.predict(input_data)
print(output)
# Batch inference
batch = np.random.randn(32, 4).astype(np.float32)
batch_output = model.predict(batch)
# Introspection
print(model.summary())
print(model.num_layers(), model.layer_names())
Roadmap
- Additional layer types (LSTM, GRU, ...)
- More activation functions (LeakyReLU, ELU, GELU, ...)
- GPU acceleration via compute shaders
- Model optimization and pruning tools
- Benchmark suite and performance metrics
Development
git clone https://github.com/James-Wirth/pocket-inference.git
cd pocket-inference
python -m venv .venv && source .venv/bin/activate
pip install maturin
maturin develop --release --features python
License
Dual-licensed under MIT or Apache 2.0.
Release files for pocket-inference 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pocket_inference-0.2.0.tar.gz | 55.8 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_x86_64.whl | CPython 3.7 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_aarch64.whl | CPython 3.7 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| pocket_inference-0.2.0-cp37-abi3-macosx_11_0_arm64.whl | CPython 3.7 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 2.1 MB
Release files / pocket_inference-0.2.0.tar.gz
| Download URL | pocket_inference-0.2.0.tar.gz |
|---|---|
| Size | 55.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56c495c7f01300a1714554d92e70418cbcf091a78b70933ad31e00a673a5fed0
|
|
BLAKE2b-256 checksum How to use checksums |
3c64fa896645f3c81187e2a7c35281e42dbe7622855ead10b085d179af627042
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency logRelease files / pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_x86_64.whl
| Download URL | pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 739.7 kB |
| Tags | CPython 3.7 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
463ef17b24ca33ad59b5d280eba0d68c2f64487a5f6f58e050e00dd1b0743b52
|
|
BLAKE2b-256 checksum How to use checksums |
1156cb48fc5af95c57b04d641824a84de6f312db09ba45562d1dfe7ba90b5cd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency logRelease files / pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_aarch64.whl
| Download URL | pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 688.5 kB |
| Tags | CPython 3.7 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d2cbdfa5678b084671f2c365de8766d7fcbba7de3c6a4bd1e659b2895fa4d0e7
|
|
BLAKE2b-256 checksum How to use checksums |
2061931a03cebc5a6fb7ea8d88f4f2abf0b4336ede535bc940dbf780d5c77ecb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency logRelease files / pocket_inference-0.2.0-cp37-abi3-macosx_11_0_arm64.whl
| Download URL | pocket_inference-0.2.0-cp37-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 586.7 kB |
| Tags | CPython 3.7 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3c334ab08dd9ae9d90c91183b699d97183f08675367f6ee6cececb131a3d8fc6
|
|
BLAKE2b-256 checksum How to use checksums |
b65592ec70b47d062b2719ae99d1e94618308c180da2480853b878748ab6f905
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency log