EmbeddedTorch
Convert your PyTorch models to embedded C++ code
EmbeddedTorch is a powerful Python library that allows you to convert PyTorch neural network models into optimized C++ code for deployment in embedded systems, microcontrollers, and resource-constrained environments.
Key Features
- 🚀 Easy Conversion: Convert PyTorch models to C++ with simple Python API
- 📦 Comprehensive Layers: Support for linear, convolutional, pooling, normalization, and activation layers
- ⚙️ Operations: Rich set of mathematical and tensor operations
- 🎯 Type-Safe: Support for different data types (float32, float64, etc.)
- 🔧 Flexible: Custom layer definitions and model composition support
- 🏗️ Production-Ready: Generate clean, optimized C++ code
Quick Start
from embeddedtorch.layers import EmbaeddableModel, LinearLayer
import torch
# Create a model
model = EmbaeddableModel(torch.float32)
model.add_layer(LinearLayer(10, 5, dtype=torch.float32))
model.add_layer(LinearLayer(5, 2, dtype=torch.float32))
# Generate C++ code
write_dep()
with open("out/code.cpp", "w", encoding="utf-8") as f:
print(cpp_code(model.list), file=f)
Documentation
- Getting Started - Installation and basic usage
- API Reference - Detailed API documentation
- Layers - Available layer types and usage
- Operations - Mathematical operations
- Examples - Complete working examples
Get Started
Ready to convert your PyTorch models to C++? Check out the Getting Started guide.
Installation
pip install embeddedtorch
License
MIT License - See LICENSE file for details
Metadata
Release files for embeddedtorch 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| embeddedtorch-0.1.4.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| embeddedtorch-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.5 kB
Release files / embeddedtorch-0.1.4.tar.gz
| Download URL | embeddedtorch-0.1.4.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
889ca8cd7eabe25e69534b6d300a6021bbcd719ab6d5d2b03421cadc24a9ebef
|
|
BLAKE2b-256 checksum How to use checksums |
9a59434a217a18e88d8edc412a3398e290026e47cbd6e8ca6c28eeaeeebad8c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Nov 19, 2025.
Transparency logRelease files / embeddedtorch-0.1.4-py3-none-any.whl
| Download URL | embeddedtorch-0.1.4-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f174c95d465b8ae2e36181467bee6dd4c4522ee7cfdf71fcd140d240ba3fc78
|
|
BLAKE2b-256 checksum How to use checksums |
527bde2f7ca58c5f71aefeb08bb046b4475fa0e51b66efcd11548f687c2d78b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Nov 19, 2025.
Transparency log