GoCNNAI ecosystem for Go.

Get Started

Candy

Minimalist machine learning framework for Go.

Multi-backend tensor acceleration:

  • CPU via BLAS (gomat with OpenBLAS or Intel MKL)
  • GPU NVIDIA via CUDA/cuBLAS/cuDNN (gocu bindings)
  • GPU Apple M-series via Metal (gomtl bindings)

Core features include tensor operations, neural network layers, convolutions, flash attention, and LLM support.

Leverages Go's native concurrency, concise syntax, and runtime efficiency for high-performance training and inference.

package main

import (
	"fmt"

	"github.com/gocnn/candy"
	"github.com/gocnn/candy/tensor"
)

func main() {
	device := candy.CPU

	a, _ := tensor.RandN[float32](0.0, 1.0, candy.NewShape(2, 3), device)
	b, _ := tensor.RandN[float32](0.0, 1.0, candy.NewShape(3, 4), device)

	c, _ := a.MatMul(b)
	fmt.Println(c)
}

Made possible by contributors

Loading contributors...

View all contributors →

Ready to build?

Explore the cookbook for tutorials and examples.

Let's go!