# tensai

A small, dependency-free neural-network framework written in pure Go, with hand-written AVX2 and NEON SIMD kernels for training and inference on ordinary CPUs.

tensai is a small machine-learning framework for learning and experimentation, implementing forward passes, backpropagation, and optimization in pure Go with no external dependencies in its default build. It provides a Matrix type with basic linear-algebra operations and a more general N-dimensional Tensor type supporting broadcasting, batched matrix multiplication, transposing views, and reshaping without copying data where possible.

Its SIMD acceleration uses Go's experimental archsimd package to hand-vectorize matrix multiplication, common activation functions, layer normalization, and the Adam optimizer update on AVX2, with a smaller set of kernels on ARM64 NEON, while remaining pure Go with no cgo or assembly files; unsupported platforms fall back automatically to portable code with identical results. Layers reuse their forward and backward scratch buffers across training steps to keep garbage collection out of the training loop, and an experimental WebGPU backend runs batched matrix multiplication on any GPU that wgpu-native reaches, again without cgo.

Its documentation site covers every package in both English and Japanese, and it is released under the MIT license.

Website: https://mattn.github.io/tensai/
