RusTorch 🚀
A production-ready deep learning library in Rust with PyTorch-like API, GPU acceleration, and enterprise-grade performance
本番環境対応のRust製ディープラーニングライブラリ - PyTorchライクなAPI、GPU加速、エンタープライズグレードパフォーマンス
RusTorch is a fully functional deep learning library that leverages Rust's safety and performance, providing comprehensive tensor operations, automatic differentiation, neural network layers, transformer architectures, multi-backend GPU acceleration (CUDA/Metal/OpenCL), advanced SIMD optimizations, and enterprise-grade memory management features.
✨ Features
- 🔥 Comprehensive Tensor Operations: Math operations, broadcasting, indexing, and statistics
- 🤖 Transformer Architecture: Complete transformer implementation with multi-head attention
- 🧮 Matrix Decomposition: Complete SVD, QR, LU decomposition and eigenvalue solver with PyTorch compatibility
- 🧠 Automatic Differentiation: Tape-based computational graph for gradient computation
- 🏗️ Neural Network Layers: Linear, Conv1d/2d/3d, ConvTranspose, RNN/LSTM/GRU, BatchNorm, Dropout, and more
- ⚡ SIMD Optimizations: AVX2/SSE4.1 vectorized operations for high performance
- 🎮 GPU Integration: CUDA/Metal/OpenCL support with automatic device selection
- 🌐 WebAssembly Support: Browser-compatible WASM bindings for client-side ML
- 📁 Model Format Support: Safetensors, ONNX inference, PyTorch state dict compatibility
- ✅ Production Ready: 739 tests passing (99.7% success rate), unified error handling system
- 📐 Enhanced Mathematical Functions: Complete set of mathematical functions (exp, ln, sin, cos, tan, sqrt, abs, pow)
- 🔧 Advanced Operator Overloads: Full operator support for tensors with scalar operations and in-place assignments
- 📈 Advanced Optimizers: SGD, Adam, AdamW, RMSprop, AdaGrad with learning rate schedulers
For detailed features, see Features Documentation.
🚀 Quick Start
Installation
Add this to your Cargo.toml
:
[]
= "0.5.0"
# Optional features
[]
= ["linalg"]
= ["rustorch/linalg"] # Linear algebra operations (SVD, QR, LU, eigenvalue)
= ["rustorch/cuda"]
= ["rustorch/metal"]
= ["rustorch/opencl"]
= ["rustorch/safetensors"]
= ["rustorch/onnx"]
# To disable linalg features (avoid OpenBLAS/LAPACK dependencies):
= { = "0.5.0", = false }
Basic Usage
use Tensor;
use ;
For more examples, see Getting Started Guide.
📚 Documentation
- Getting Started - Basic usage and examples
- Features - Complete feature list and specifications
- Performance - Benchmarks and optimization details
- Architecture - System design and project structure
- Examples - Comprehensive code examples
- API Documentation - Detailed API reference
- GPU Acceleration Guide - GPU setup and usage
- Production Guide - Deployment and scaling
📊 Performance
Latest benchmark results:
Operation | Performance | Details |
---|---|---|
Tensor Addition | 34K - 2.3M ops/sec | ✅ Broadcasting support |
Tensor Sum | 52M+ ops/sec | ✅ Consistently high performance |
Matrix Multiplication | 0.71 - 0.77 GFLOPS | ✅ Stable scaling |
Neural Network Inference | 15 - 60 inferences/sec | ✅ Batch processing |
For detailed performance analysis, see Performance Documentation.
⚠️ 後方互換性について (Backward Compatibility)
v0.5.0での重要な変更 / Important Changes in v0.5.0:
この版では、メソッド統合リファクタリングにより、従来の_v2
バージョンと古いバージョンのメソッドが統一されました。以下の点にご注意ください:
- メソッド名の変更:
_v2
接尾辞が削除され、最適化版が標準になりました - 統一されたAPI: 旧バージョンと
_v2
バージョンが単一の最適化版に統合されました - 移行の必要性: 旧APIを使用している場合は、新しいメソッド名への移行が必要です
詳細な移行ガイドについては、CHANGELOG.mdのv0.5.0セクションをご参照ください。
🧪 Testing
All 739 tests passing - Production-ready quality assurance with unified error handling system.
# Run all tests
# Run with release optimizations
🚀 Production Deployment
Docker
# Production deployment
# GPU-enabled deployment
For complete deployment guide, see Production Guide.
🤝 Contributing
We welcome contributions! See areas where help is especially needed:
- 🎯 Special Functions Precision: Improve numerical accuracy
- ⚡ Performance Optimization: SIMD improvements, GPU optimization
- 🧪 Testing: More comprehensive test cases
- 📚 Documentation: Examples, tutorials, improvements
- 🌐 Platform Support: WebAssembly, mobile platforms
Development Setup
# Run tests
# Check formatting
# Run clippy
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.