Skip to content
Astrohacker

← Projects

Archived project · GPU tensor shell

NuTorch

A Nushell-based shell with native tensors.

NuTorch made tensors values that shell commands could pass through a pipeline. It used LibTorch for numerical work and supported GPU computation through Metal.

Astrohacker published the shell through Homebrew, with the tensor runtime included in the distribution.

How it works

  • Pass tensors through a shell pipeline

    NuTorch 2.0 represented tensors as native Nushell values in the shell process. Commands could share the underlying storage without passing identifiers for tensors held in an external daemon.

  • Differentiate a calculation

    A tensor could track gradients. Squaring it, summing the result and running backward accumulated a gradient on the original tensor. LibTorch supplied the numerical runtime and supported the MPS backend on Apple silicon.

  • Train without switching runtimes

    Native neural-network and optimizer values shared the runtime used for tensor operations. The binary bundled its required LibTorch libraries. The public README distinguishes the unfinished AI input mode from commands that actually ran.

Check the derivative of a sum of squares

The derivative of the sum of squares at [1, 2, 3] is [2, 4, 6]. This pipeline from the project README gives a human or an agent an exact numerical result to test across shell parsing, tensor storage and automatic differentiation.

use torch
let x = torch tensor [1 2 3] --requires-grad
$x | torch mul $x | torch sum | torch backward
$x | torch grad | torch value

Project history

  1. The announcement introduced GPU data analysis in Nushell backed by the C++ library used by PyTorch. NuTorch announcement

  2. The portfolio described the native shell and packaging changes. September portfolio

  3. The independent binary release reached 2.0.15. NuTorch release

Sources