A minimal deep learning framework with a PyTorch-like tensor API, autograd, a compiler, and support for many accelerator backends.
- Stars
- 1,415
- Forks
- 102
- Open issues
- 166
- Last commit
- 19 days ago
What is it?
Arraymancer is an ndarray (tensor) library written in Nim, inspired by NumPy and PyTorch. It provides N-dimensional arrays with slicing, broadcasting, reshaping and linear algebra primitives such as matrix multiplication, least squares, eigendecomposition, PCA and k-means.
Beyond the array core, it includes an autograd-based neural network DSL for defining, training and running models, with layers such as Linear, Conv2D, MaxPool2D and GRU. Tensors can run on the CPU with OpenMP-parallelized routines backed by BLAS/LAPACK, or on CUDA (with optional cuDNN) and OpenCL devices, though GPU tensors support fewer operations than CPU tensors.
The library compiles quickly and produces self-contained binaries that depend mainly on a BLAS library, which the README positions as suitable for embedded devices and Raspberry Pi. The project is marked experimental, and its deep learning interface is still being finalized.
Key features
- 01N-dimensional tensors up to 6 dimensions with numpy-style slicing and explicit broadcasting via +.
- 02Reshaping and joining operations such as concat, reshape, split, permute and transpose.
- 03Read and write CSV, NumPy (.npy) and HDF5 files.
- 04Linear algebra routines including least squares, eigendecomposition and covariance matrices.
- 05Autograd-based neural network DSL with Linear, Conv2D, pooling and GRU layers.
- 06CPU, CUDA and OpenCL tensor backends, with CUDA and OpenCL offering fewer operations.
Use cases
- Numerical computing projects in Nim that need fast multidimensional arrays.
- Prototyping small neural networks in Nim with autograd and a concise model definition syntax.
- Deploying models on resource-constrained devices where a large Python stack is impractical.
- Classical machine learning tasks like PCA, k-means and least squares fitting in Nim code.
Quick start
- 1
Install Nim with choosenim
- 2
Install Arraymancer with nimble
nimble install arraymancer
Things to know
- The project is marked experimental, and its deep learning interface is considered unstable and still changing.
- Arraymancer requires a BLAS and a LAPACK library to be installed on the system.
- The CUDA and OpenCL backends are less feature-complete than the CPU tensors.
Topics
FAQ
- What is Arraymancer?
- A fast, ergonomic N-dimensional tensor library in Nim with CPU, CUDA and OpenCL backends, aimed at numerical computing and deep learning. Arraymancer is an ndarray (tensor) library written in Nim, inspired by NumPy and PyTorch. It provides N-dimensional arrays with slicing, broadcasting, reshaping and linear algebra primitives such as matrix multiplication, least squares, eigendecomposition, PCA and k-means.
- Is Arraymancer free to use? What license does it have?
- Arraymancer is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is Arraymancer still maintained?
- Actively maintained. The last commit to Arraymancer was on Oct 6, 2026.
- What can I use Arraymancer for?
- Numerical computing projects in Nim that need fast multidimensional arrays. Prototyping small neural networks in Nim with autograd and a concise model definition syntax. Deploying models on resource-constrained devices where a large Python stack is impractical. Classical machine learning tasks like PCA, k-means and least squares fitting in Nim code.
- How do I install Arraymancer?
- Install Nim with choosenim Install Arraymancer with nimble: nimble install arraymancer
- Where can I get Arraymancer?
- The source code and installation instructions are on GitHub: https://github.com/mratsim/Arraymancer
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An open machine learning compilation framework that lets developers customize compiler pipelines in Python and deploy models to many hardware targets.
A Python deep learning framework offering GPU-accelerated tensor computation and dynamic neural networks built on autograd.
A learn-by-building ML course: a from-scratch NumPy deep learning framework (CLI modules) plus 350+ browser-based coding questions graded in Pyodide.
A Rust tensor library and deep learning framework for training and inference across CUDA, ROCm, Metal, Vulkan, WebGPU and CPU backends.
CUDA C++ template library and Python DSL for writing high-performance GEMM and related linear algebra kernels on NVIDIA GPUs.