轻量级张量库,体积仅几兆,性能媲美主流框架
MiniTensor: A Lightweight, High-Performance Tensor Operations Library
- 用 Rust 实现核心运算,通过 PyO3 与 Python 交互
- 包大小仅数兆,比 PyTorch、TensorFlow 小几个数量级
- 支持自动微分、神经网络层和优化器,适合科研开发
我们提出 MiniTensor,一个开源的轻量级张量操作库,强调极简性、正确性和高性能。MiniTensor 提供类似 PyTorch 的 Python API,关键计算由 Rust 引擎执行。核心功能包括密集 n 维张量、广播、归约、矩阵乘法、反向模式自动微分、少量神经网络层及标准优化器。本文阐述其架构设计,涵盖高效的内存管理、动态计算图实现以及通过 PyO3 与 Python 的集成方式。与 PyTorch、TensorFlow 对比显示,MiniTensor 的安装包体积仅数兆字节,小数个数量级,同时保留了在 CPU 上进行研究与开发所需的核心功能。代码仓库地址:https://github.com/neuralsorcerer/minitensor
原文摘要 · Abstract (English)
We present MiniTensor, an open source tensor operations library that focuses on minimalism, correctness, and performance. MiniTensor exposes a familiar PyTorch-like Python API while it executes performance critical code in a Rust engine. The core supports dense $n$ dimensional tensors, broadcasting, reductions, matrix multiplication, reverse mode automatic differentiation, a compact set of neural network layers, and standard optimizers. In this paper, we describe the design of MiniTensor's architecture, including its efficient memory management, dynamic computation graph for gradients, and integration with Python via PyO3. We also compare the install footprint with PyTorch and TensorFlow to demonstrate that MiniTensor achieves a package size of only a few megabytes, several orders of magnitude smaller than mainstream frameworks, while preserving the essentials needed for research and development on CPUs. The repository can be found at https://github.com/neuralsorcerer/minitensor
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。