TenfloweRS
A pure Rust implementation of TensorFlow, providing a comprehensive deep learning framework with Rust's safety and performance guarantees.
Overview
TenfloweRS is the main convenience crate that re-exports all TenfloweRS subcrates, providing a unified API for deep learning in Rust. Built on the robust SciRS2 ecosystem, it offers:
- Production-Ready: Full-featured neural networks, training, and deployment
- High Performance: GPU acceleration, SIMD optimization, mixed precision
- Type Safety: Rust's type system prevents common ML bugs at compile time
- Cross-Platform: CPU, GPU (CUDA, Metal, Vulkan), and WebGPU support
- Ecosystem Integration: Seamless integration with SciRS2, NumRS2, and OptiRS
Quick Start
Add TenfloweRS to your Cargo.toml:
[]
= "0.1.0-beta.1"
Basic Example
use *;
Build a Neural Network
use *;
Train a Model
use *;
Features
TenfloweRS provides several optional features:
Default Features
std: Standard library supportparallel: Parallel execution via Rayon
GPU Acceleration
gpu: GPU acceleration via WGPU (Metal, Vulkan, DirectX, WebGPU)cuda: CUDA support (Linux/Windows only)cudnn: cuDNN support (requires CUDA)opencl: OpenCL supportmetal: Metal support (macOS only)rocm: ROCm support (AMD GPUs)nccl: NCCL for distributed GPU training
BLAS Acceleration
blas: Generic BLAS supportblas-openblas: OpenBLAS accelerationblas-mkl: Intel MKL accelerationblas-accelerate: Apple Accelerate framework (macOS only)
Performance & Optimization
simd: SIMD vectorization optimizations
Serialization & I/O
serialize: Serialization support (JSON, MessagePack)compression: Compression support for checkpointsonnx: ONNX model import/export
Platform Support
wasm: WebAssembly support
Development
autograd: Automatic differentiation supportbenchmark: Benchmarking utilities
Language Bindings
python: Python bindings via PyO3 ⚠️ Temporarily excluded in beta.1 (requires Python environment)
Convenience
full: Enable most features (gpu, blas-openblas, simd, serialize, compression, onnx, autograd)
Enable GPU Support
[]
= { = "0.1.0-beta.1", = ["gpu"] }
Enable All Features
[]
= { = "0.1.0-beta.1", = ["full"] }
Architecture
TenfloweRS is organized into focused subcrates:
- tenflowers-core: Core tensor operations and device management
- tenflowers-autograd: Automatic differentiation engine
- tenflowers-neural: Neural network layers and models
- tenflowers-dataset: Data loading and preprocessing
- tenflowers-ffi: Python bindings (optional)
This meta crate re-exports all public APIs for convenience.
SciRS2 Integration
TenfloweRS is built on the SciRS2 scientific computing ecosystem:
TenfloweRS (Deep Learning Framework - TensorFlow-compatible API)
↓ builds upon
OptiRS (ML Optimization Specialization)
↓ builds upon
SciRS2 (Scientific Computing Foundation)
↓ builds upon
ndarray, num-traits, etc. (Core Rust Scientific Stack)
This architecture provides:
- Advanced numerical operations via
scirs2-core - Automatic differentiation via
scirs2-autograd - Neural network abstractions via
scirs2-neural - Optimized algorithms via
optirs
Examples
See the examples directory for more comprehensive examples:
Documentation
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).
Status
TenfloweRS is currently in beta (v0.1.0-beta.1). The core API is stabilizing for 1.0 release. All 2357 tests passing, zero security vulnerabilities.