mushin

Library Listed Dormant

Computational graphs with reverse automatic differentation in the GPU

Checked · Sources

Downloads
0
Dependents
0
Stars
396
Forks
9
Contributors
2
Commits
58
Latest release
0.5.0 ·

About

From the project README ·

Mushin is a Japanese term used in martial arts that refers to the state of mind obtained by practice. At this point, a person relies not on what they think should be the next move, but what is their trained natural reaction (or instinct).

Description

Mushin is a pure Rust, no-unsafe library for computing gradients on dynamic computational graphs using reverse automatic differentiation. In other words, what PyTorch is to Python is what Mushin is to Rust.

Internally it uses the arrayfire crate to provide parallel computations on specialized hardware, such as Nvidia CUDA GPUs, Intel MKL CPUs... For details on what devices are available and installation instructions for your OS, please take a look at the arrayfire crate documentation. The installation of the arrayfire binaries is required for Mushin to work.

Read the full README

One clear benefit of this crate versus PyTorch is Rust's strong type system. All operations performed on tensors during the graph build are checked at compile time for mathematical soundness, which means no runtime error after an hour of model training. If it compiles, it works. If at some point you make a mistake while building your made in hell nested computational graph, like for example on the shape of a tensor, you'll be stopped even before you can start feeling stupid.

Moreover, because constant and variable tensors are actually different types, the developer continuously has an overview of which resulting tensors contribute to the gradients and which not. On top of that, the compiler will stop you from trying to compute the gradient of or with respect to a constant!

Another benefit when compared to other similar libraries is that the computation graph is eagerly evaluated, which means that the graph is trully dynamic. In other words, your next operations can be conditioned to the results of previous ones, and so you can have conditional branching while building your graph.

Usage

First, install the arrayfire binaries as indicated by the arrayfire crate.

Then, add mushin as one of your dependencies:

[dependencies]
mushin = "0.5"

The following is quite a self-explanatory example of the basic usage of Mushin to build computation graphs and get the derivatives back:

use mushin as mu;

fn main() {
    let x = mu::eye::<1, 1, 2, 3>(3.0).freeze();
    let w = mu::randn::<1, 1, 3, 2>();
    let b = mu::fill::<1, 1, 3, 3>(0.0);

    let z = mu::add(&mu::mm(&w, &x), &b);
    z.backward();

    let dz_dw = w.grad()
    let dz_db = b.grad()
}

By default, this library enables the nn feature that gives access to the nn module, which builds upon the auto-grad foundation of Mushin to deliver a set of Deep Learning utilities, such as activation functions, layers, losses and optimizers. If you don't really need that part and you are only insterested in the pure auto-grad functionality of this library, the nn module can be disabled with default-features = false. Here follows a brief example on how it works:

use mushin as mu;
use mu::nn::{layers::Linear, activations::relu, losses::mse, optimizers::SGD};

let x = mu::eye::<16, 1, 1, 3>(1.0).freeze();
let y = mu::eye::<16, 1, 1, 5>(3.0).freeze();

let linear = Linear::<16, 3, 5>::new();
let optim = SGD::new(&[linear.parameters()], 0.01);

for _ in 0..5 {
    let z = relu(&linear.forward(&x));
    let loss = mse(&z, &y);
    
    loss.backward();
    optim.step();
    loss.reset();
}

Contributing

  • If you find a vulnerability, bug or miss something, please open a new issue
  • To introduce your changes into the codebase, submit a pull request
  • To discuss about possible improvements, suggestions and new fearures, join us in Slack!

Many thanks!

License

Mushin is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT, and COPYRIGHT for details.

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
None found
  • No native code found
Python bindings
No Python binding crate found
License
Apache-2.0 OR MIT

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

mushin beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
mushin This page Listed Dormant

Computational graphs with reverse automatic differentation in the GPU

0 downloads over 30 days 0 396 0.5.0 GPU support unknown No native code found Apache-2.0 OR MIT
candle Featured

Minimalist ML framework.

Python bindings

1,766,495 downloads over 30 days 692 21,287 0.11.1 CUDA, Metal Binds native code: accelerate-src (feature accelerate), intel-mkl-src (feature mkl), alsa-sys (feature encodec) Apache-2.0 OR MIT
burn Featured

Flexible and Comprehensive Deep Learning Framework in Rust

521,465 downloads over 30 days 391 16,257 0.22.1 CUDA, WebGPU, Metal, ROCm, Vulkan Binds native code: netlink-sys (feature iroh), nvml-wrapper-sys (feature sys-metrics), torch-sys (feature tch) Apache-2.0 OR MIT
dfdx Listed Dormant

Ergonomic auto differentiation in Rust, with pytorch like apis.

2,369 downloads over 30 days 4 1,944 0.13.0 CUDA No native code found Apache-2.0 OR MIT
boostr Listed

ML framework on numr for training and inference on CPU, CUDA and WebGPU: attention, quantization, inference scheduling and distributed execution. Models include LLaMA, Mamba2, Qwen3.5, Whisper, Kokoro, VITS, VoxCPM2, Silero VAD, CLAP and super-resolution. Loads SafeTensors and GGUF.

1,265 downloads over 30 days 7 20 0.11.2 CUDA, WebGPU Binds native code: ring (feature distributed) Apache-2.0
RustTensor App Listed Dormant

A learning-focused, high-performance tensor computation library built from scratch in Rust, featuring automatic differentiation and CPU/CUDA backends.

Not measured Not applicable 79 Not measured Not measured Not measured MIT
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 0 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 396 stars, 9 forks and 2 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
  • The project is dormant and not finished. Dormancy rule

What else the check found

  • The last activity is on 9 Jul 2022, 1584 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
  • The oldest outside issue waits 735 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule

Not measured: Latest release fails cargo check.

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.5.0 base 140, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2022-07-09, 1584 days ago, E = 365: dormant
  • rot: oldest unanswered issue 735 days (limit 270), no maintainer reply in 365 days
  • featured: not featured: active_users 0 < 11 and new_adopters 0 < 9 and repository route stars 396 (needs 4539), forks 9 (needs 434), contributors 2 (needs 79); dormant and not stable
  • listed: listed: no archive, new or featured rule applies
Crates2 crates

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents0crates.io database dumpYes
New dependents (365 days)0crates.io database dumpYes
Peak active dependents0crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 4 years ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2022-07-09GitHub repositoryYes
Latest release2022-06-07crates.io database dumpYes
First release2021-04-08crates.io database dumpYes
Latest version0.5.0crates.io database dumpYes
Days the oldest outside issue waits for a reply735GitHub repositoryYes
Maintainer replies over 365 days0GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution6 releases, 0 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases6crates.io database dumpYes
Downloads over 30 days0crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository396 stars, 9 forks, 2 contributors, 58 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars396GitHub repositoryYes — one part of the repository route
GitHub forks9GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account2GitHub contributorsYes — one part of the repository route
Commits on the default branch58GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0 OR MITcrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly0crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.