I made a tensor runtime & inference framework in C (good for learning how inference works)
github.comΒ·16hΒ·
Flag this post

PrimitiveML β€” Minimal tensor runtime & inference framework in C

PrimitiveML is a minimalist tensor library and inference framework written in C, inspired by PyTorch. It provides a low-level tensor runtime and a modular layer system (Module/Linear/Embedding) with forward()-style calls similar to PyTorch. The repository includes an example of running a small character-based GPT-2 model exported from PyTorch (see `nanogpt).

Features

  • Low-level tensor runtime with dynamic shapes, dtypes and strides.
  • Tensor ops: reshape, transpose, unsqueeze.
  • Element-wise ops with automatic broadcasting, reductions and matrix multiplication.
  • Basic activations: ReLU, Sigmoid, Softmax.
  • Modular API: Module, Linear, Embedding with forward() semantics.
  • Demo: infer…

Similar Posts

Loading similar posts...