Forge (Metal Neural Network Toolkit)

Forge (Metal Neural Network Toolkit)

โ˜… 3.8 ๐Ÿ”– 1200 saves ๐Ÿ’ฐ Free GitHub

Forge is an open-source neural network toolkit for Apple’s Metal framework, written in Swift by Matthijs Hollemans to make deep neural networks on iOS and macOS easier to build by hand.

Overview

Forge is a collection of helper code that sits on top of Apple’s MPSCNN framework and removes much of its boilerplate. A small domain-specific language lets you define a network as a readable chain of layers – input, resize, convolution, max pooling, dense, softmax – instead of pages of Metal setup code. Around that core it adds conversion functions between MPSImage/MTLTexture and plain Swift float arrays, custom layers that MPSCNN lacks (such as depthwise convolution), preprocessing kernels, helpers for writing your own compute kernels, and debugging tools for inspecting what a network actually computed. It ships with complete example apps using pretrained networks: LeNet-5 on MNIST, Inception-v3 for image classification, Tiny YOLO for object detection, and MobileNets running at 20 FPS on an iPhone 6s. The project has about 1,265 stars on GitHub. One honest caveat, stated in its own README: the author no longer maintains Forge – it targets the older MPSCNN APIs of the iOS 10/11 era (last push in 2018), and Core ML now covers most of the needs it originally served. It remains a clear, readable reference for how GPU neural networks are implemented on Apple hardware.

Key Features

  • Layer-definition DSL that turns MPSCNN boilerplate into short, readable Swift chains
  • Conversion helpers between Metal textures and Swift arrays, including 16-bit float handling
  • Custom layers beyond MPSCNN, such as depthwise convolution and channel transposition
  • Preprocessing and custom compute-kernel helpers for Metal shaders
  • Example projects with pretrained LeNet-5, Inception-v3, Tiny YOLO and MobileNets models
  • Debugging tools for verifying that a network computes the correct results

๐Ÿ’ณ Pricing

Forge is completely free and open source under the MIT license, with no paid tiers or services attached.

Who Is It For

Forge is for developers and students who want to understand or experiment with hand-built GPU neural networks on Apple hardware, and for anyone maintaining legacy MetalPerformanceShaders code from the pre-Core ML era.

๐Ÿš€ Visit Forge (Metal Neural Network Toolkit) Official Site

๐Ÿšฉ Report an issue