Skip to main content

ML framework with tensors, autograd, NN modules, optimizers, transformers.

Project description

tiramisu

MNIST training — loss over 10 epochs

A from-scratch ML framework in C++20 — about 5,000 lines of readable, PyTorch-familiar code with a Python binding.

  • Stdlib-only compute (no Eigen, no BLAS, no PyTorch at link time)
  • Tensor, requires_grad, backward(), Module, Linear, Adam — Python and C++
  • AVX2/FMA matmul on x86, scalar fallback elsewhere
  • Optional CUDA backend for GPU training
  • End-to-end MNIST and char-level GPT examples

CMake on multiple platforms

Install

pip install tiramisu-ml

Requires Python 3.10+. Wheels ship for Linux (x86_64, aarch64) and macOS (x86_64, arm64); other platforms build from sdist and need CMake + a C++20 compiler.

Quick start

import numpy as np
import tiramisu as tr

x = tr.from_numpy(np.random.randn(2, 784).astype(np.float32))
layer = tr.nn.Linear(784, 10)
out = layer.forward(x)
print(out.shape())  # [2, 10]

Training step:

opt.zero_grad()
h = tr.relu(layer1.forward(batch_x))
logits = layer2.forward(h)
loss = tr.nn.cross_entropy_loss(logits, batch_y)
loss.backward()
opt.step()

C++ mirrors the Python API — see examples/mnist.cpp.

API

Tensor opsadd, sub, mul, div, neg, matmul, sum, mean, reshape, transpose, contiguous, relu, gelu, softmax, from_numpy, backward

Modulesnn.Linear, nn.LayerNorm, nn.GPT, nn.cross_entropy_loss

Optimizersoptim.Adam

Full binding reference in python/README.md.

Examples

MNIST (CPU, ~10 epochs to 95%+):

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --target mnist
./build/examples/mnist

Data: MNIST IDX files in data/.

Char-level GPT on Tiny Shakespeare:

cmake --build build --target train_shakespeare
./build/examples/train_shakespeare --preset tiny --epochs 3

Presets: tiny, 2m, 10m. Add --cuda for GPU.

Build from source

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build --output-on-failure

CUDA: -DTIRAMISU_ENABLE_CUDA=ON. Debug builds enable ASan+UBSan by default.

Layout

core/       Storage, Tensor, dtype, device
ops/cpu/    Forward kernels (elementwise, reduce, matmul, normalization)
ops/cuda/   Optional CUDA kernels
autograd/   Differentiable wrappers, backward(), gradcheck
nn/         Module, Linear, GPT, LayerNorm, loss
optim/      SGD, Adam, AdamW, grad clipping, cosine LR
python/     pybind11 bindings
serialize/  GPT checkpoint save/load
examples/   hello_tiramisu, mnist, train_shakespeare

GoogleTest is the only non-stdlib fetch at configure time. License: MIT.

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

tiramisu_ml-0.1.1.tar.gz (549.4 kB view details)

Uploaded Source

Built Distributions

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

tiramisu_ml-0.1.1-cp313-cp313-manylinux_2_28_x86_64.whl (332.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

tiramisu_ml-0.1.1-cp313-cp313-manylinux_2_28_aarch64.whl (309.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

tiramisu_ml-0.1.1-cp313-cp313-macosx_13_0_x86_64.whl (196.2 kB view details)

Uploaded CPython 3.13macOS 13.0+ x86-64

tiramisu_ml-0.1.1-cp313-cp313-macosx_13_0_arm64.whl (176.3 kB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

tiramisu_ml-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl (333.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

tiramisu_ml-0.1.1-cp312-cp312-manylinux_2_28_aarch64.whl (309.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

tiramisu_ml-0.1.1-cp312-cp312-macosx_13_0_x86_64.whl (196.1 kB view details)

Uploaded CPython 3.12macOS 13.0+ x86-64

tiramisu_ml-0.1.1-cp312-cp312-macosx_13_0_arm64.whl (176.2 kB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

tiramisu_ml-0.1.1-cp311-cp311-manylinux_2_28_x86_64.whl (333.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

tiramisu_ml-0.1.1-cp311-cp311-manylinux_2_28_aarch64.whl (309.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

tiramisu_ml-0.1.1-cp311-cp311-macosx_13_0_x86_64.whl (195.5 kB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

tiramisu_ml-0.1.1-cp311-cp311-macosx_13_0_arm64.whl (176.5 kB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

tiramisu_ml-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl (332.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

tiramisu_ml-0.1.1-cp310-cp310-manylinux_2_28_aarch64.whl (309.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

tiramisu_ml-0.1.1-cp310-cp310-macosx_13_0_x86_64.whl (193.8 kB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

tiramisu_ml-0.1.1-cp310-cp310-macosx_13_0_arm64.whl (175.2 kB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

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

File metadata

  • Download URL: tiramisu_ml-0.1.1.tar.gz
  • Upload date:
  • Size: 549.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tiramisu_ml-0.1.1.tar.gz
Algorithm Hash digest
SHA256 84da15dc7b1393729f9ebe19ed5b6449201a8f57c6d1d0702e5a967aa2429adf
MD5 f4811420362c430384fd720a4b7243d4
BLAKE2b-256 e44c352d537fd9426755d92c0752f12082be3eab04720f4ae5a01aca3fb5c1b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1.tar.gz:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1366295697d196602d37e95e0fa44a8dba4eb58ad2da3a4625a4c04b44ecb9dc
MD5 e5865e4aa7f73143bf623a30cce2b916
BLAKE2b-256 c3b0aac0185849a619c045d541bd25db2325ed46a7026adfacb5f264975c3eaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c8244b0fb0bd2f79cee1bfb71a1abfa5c6119e92b2b1fb70b37b8123f37233d2
MD5 e8093de68ba0b45709a99f6932ac89a0
BLAKE2b-256 2ee47df945229f4d36da3971bec90b33a59751fdaa0a6022f2fead15153c54bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp313-cp313-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp313-cp313-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 8be897d00b779ed780ff027ea6ca24ff62cad33a6de235ae510591a731873c4c
MD5 6dfbbe66f33df12c5f4d79202604d033
BLAKE2b-256 7695ca6a56aa270e91934f0875d1da81dbd67327f9b650fe6efe6da1ab2ce681

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp313-cp313-macosx_13_0_x86_64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp313-cp313-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 d21355fd47f7678b2eeb8fe76d97da4a36046f109ac012979aeb4cd1c506829d
MD5 d539829555a77e64caaa56e95c5210a5
BLAKE2b-256 c639a2bb281eb4e9f6a46bf0288918d508695b337c9ee321f18af13f73347928

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp313-cp313-macosx_13_0_arm64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5112af4a94edd1b13ffa7d661089faf750decc6355c61bfe8ef531beed36aa36
MD5 ad60c9c280709160eb08d7b875e831d5
BLAKE2b-256 1f24cd54d13a23da664e26910857cfb006171ee7a34616cdbc2ae3fe480f0941

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e1a816327d2c0dd01408d0fd6b684c2ceb51ba8ec79dbd22128bde64a5853f2b
MD5 42e9942915be2353c5718b7cc80abb93
BLAKE2b-256 96d691aa4f86f64ed4942bf935fea782d47ad7772466b9495d1e6824b925e4c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 52d8ea3c6dd2c2110727958e737e4d31914191e247f062afdb73794c3f2fb464
MD5 efe96bd9aeb22f06d17b6a5611139b58
BLAKE2b-256 6d9146cb4863836241f84657f39507d01f094e7f7c9b1b1d633f4f1b1ec2622a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp312-cp312-macosx_13_0_x86_64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 766f0cadb1ba9fdacabcbc0e23d780226a31a5a0292d21bb549838bb87579884
MD5 0020c54b82584b216b42fa152a730378
BLAKE2b-256 352d7160dda7797932e534ac844be05b380a6d67121e2661bff015e5203a4eec

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp312-cp312-macosx_13_0_arm64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e23c890cdc9c1eec5841cfe54f24e431b2a5ef713629e14ef29c5b62dc8ea4b2
MD5 e4959c4ea4f219232324e6273284a989
BLAKE2b-256 5beadfc5f2c1f2aa46895143296eb8fc95d75d07395ac0d544d23eac6598e64b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9bb0b0d51221fbeaf33275dc36e77758d6dd190745ed949dc4e796d69aa40ee5
MD5 5a2237fc121b38f35b72fe6652643a4b
BLAKE2b-256 52776ddc92b0c69bf50f0f8e02ecb7bc6776c416efe2a4d848425ca84abe92ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp311-cp311-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 84019d3132d7658fb4e5d80480b0c072a06f9001a66786bc77af0882da2fc915
MD5 b07b8fcee3762d91255351221c2caef4
BLAKE2b-256 d90a50f751a427fdd186f79bee0957dd68008b44ee4b9a4e5305ba252e8dde0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp311-cp311-macosx_13_0_x86_64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 80af53ec9ff3a297b58167b8f488b965f1190913174d1d534a53bf2ca8b4df07
MD5 c233175daebced092042f8b139f94cd6
BLAKE2b-256 75d4ab1b1e65a03e0f2a290532eeaea3dfdb2a9365465db6aab73bd18a1a7cd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp311-cp311-macosx_13_0_arm64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3660243697d683d601d8570157a87f89fa2c647e1d585f692c14526b50afaf42
MD5 d83a18df0f88b407797f4d1da4fbf6ec
BLAKE2b-256 c88152f683f1a08267ee35ef345fce138277b7e220a66e700d86346a138de8e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f2c341fe0f08da7e285cff7ab48a9bf50cdf2f670af2d4421d925b0177d638ca
MD5 43548f7ff2f1bc46fbdc36a33ee21228
BLAKE2b-256 57ab813f6755a4e18115513e33b7b978146bb7356c9f72e03d2465ebc78a9b8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp310-cp310-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 a3bf6f12e64006d546c2289c19b008a76889cb8a413b7c9a76771840eeb5448f
MD5 c43087aa1bbf05d777a8b0fb8253ec0b
BLAKE2b-256 421567dd3ce341589b5435e1f77420620ff9d8cbd982ad6d69585498ea53b3c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp310-cp310-macosx_13_0_x86_64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

File details

Details for the file tiramisu_ml-0.1.1-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for tiramisu_ml-0.1.1-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 51447098f12ec7395e20093442a175f86cdef2baa7e5ef6bf1cea883dbcf2b2f
MD5 dd904d9354ae6365b83d0a1614e64223
BLAKE2b-256 31c411a3a3f183f1f8f8406f9fa4136026e655f6161092cb3394e549d4c5694c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tiramisu_ml-0.1.1-cp310-cp310-macosx_13_0_arm64.whl:

Publisher: publish.yml on dnexdev/tiramisu

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

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