Home / Documentation / Examples

Code Examples

Explore practical examples demonstrating LOOM's capabilities across different use cases.

Getting Started Examples

Simple Dense Network

Basic feedforward neural network with Dense layers for classification tasks.

View on GitHub →

Training Loop

Complete example showing training with gradient descent, loss tracking, and validation.

View on GitHub →

Model Serialization

Save and load models as JSON for deployment across platforms.

View Documentation →

Layer Type Examples

Conv2D Example

2D convolutional neural network for image processing tasks.

View on GitHub →

Multi-Head Attention

Transformer-style attention mechanism with GPU-accelerated matrix operations.

View on GitHub →

RNN Example

Recurrent neural network for sequence processing with BPTT.

View on GitHub →

LSTM Example

Long Short-Term Memory network with gated cells for long-range dependencies.

View on GitHub →

Advanced Examples

MoE Proof Demo

Mathematical proof that Grid Softmax equals Mixture of Experts with 97.1% loss reduction.

View on GitHub →

CPU vs GPU Benchmark

Comprehensive performance comparison across all layer types.

View Benchmarks →

All Layers Validation

End-to-end validation test with all 5 layer types and 10 softmax variants.

View on GitHub →

Multi-Language Examples

Python (welvet)

High-level Python API examples using the welvet package.

View on GitHub →

JavaScript/TypeScript WASM

Browser-based neural network training and inference with WebAssembly.

View on GitHub →

C# / .NET

.NET examples using P/Invoke bindings with the Welvet package.

View on GitHub →

C/C++ (C-ABI)

C Foreign Function Interface examples with shared library.

View on GitHub →

Interactive Demo

Fabric Interactive Demo

The LOOM repository includes an interactive demo application called "fabric" that lets you explore all features:

cd loom/fabric
go build
./fabric

Choose from options including Dense, Conv2D, Attention, RNN, LSTM demos, and comprehensive CPU vs GPU benchmarks.

Repository Structure

Find examples in these directories:

  • fabric/demos/ - Individual layer demonstrations
  • examples/ - Validation tests and benchmarks
  • python/examples/ - Python-specific examples
  • typescript/examples/ - TypeScript/WASM examples
  • csharp/examples/ - C#/.NET examples
  • wasm/ - WebAssembly deployment examples
  • cabi/ - C Foreign Function Interface examples
Browse All Examples
Visit the LOOM repository on GitHub to explore all examples, clone the repository, and try them locally.