Build neural network models in Cairo 1.0

Overview

Explore ML in Cairo 1.0 PRs Welcome

Build neural network models in Cairo 1.0 to perform inference.


The calculations are performed using i33 values, and the outcomes are quantized into 8 bits based on the ONNX standard for symmetric quantization.

Installation

Follow the auditless/cairo-template instructions.

How to use it?

Build

Build the code.

$ make build

Test

Run the tests in src/tests:

$ make test

Features

Layers

  • Linear
  • Conv2d
  • MaxPool2d

Activations

  • ReLu
  • Softmax

Math

Matrix

  • Matrix representation
  • Matrix dot vector
  • Slice matrix

Vector

  • Sum vectors
  • Dot vectors
  • Find in vectors
  • Slice vector
  • Concat vectors

Signal

  • Valid 2D cross-correlation

Performance

Quantizations

  • 8-bit symmetric quantization

TODO

  • MNIST example
  • more

Credits

Comments
  • feat: implement max pool 2d

    feat: implement max pool 2d

    feat: Implement max pool 2d

    Pull Request type

    Please check the type of change your PR introduces:

    • [ ] Bugfix
    • [X] Feature
    • [ ] Code style update (formatting, renaming)
    • [ ] Refactoring (no functional changes, no API changes)
    • [ ] Build-related changes
    • [ ] Documentation content changes
    • [ ] Other (please describe):

    What is the current behavior?

    There is no implementation of Max Pool 2d

    What is the new behavior?

    • implement max pool 2d
    • unit testing

    Does this introduce a breaking change?

    • [ ] Yes
    • [X] No

    Other information

    opened by raphaelDkhn 0
  • feat: Implement softmax

    feat: Implement softmax

    feat: Implement softmax

    Pull Request type

    Please check the type of change your PR introduces:

    • [ ] Bugfix
    • [X] Feature
    • [ ] Code style update (formatting, renaming)
    • [ ] Refactoring (no functional changes, no API changes)
    • [ ] Build-related changes
    • [ ] Documentation content changes
    • [ ] Other (please describe):

    What is the current behavior?

    There is no implementation of Softmax

    What is the new behavior?

    • implement softmax
    • unit testing

    Does this introduce a breaking change?

    • [ ] Yes
    • [X] No

    Other information

    opened by raphaelDkhn 0
  • feat: Implement Fixed Point Q5.26

    feat: Implement Fixed Point Q5.26

    feat: Implement Fixed Point Q5.26

    Pull Request type

    Please check the type of change your PR introduces:

    • [ ] Bugfix
    • [X] Feature
    • [ ] Code style update (formatting, renaming)
    • [ ] Refactoring (no functional changes, no API changes)
    • [ ] Build-related changes
    • [ ] Documentation content changes
    • [ ] Other (please describe):

    What is the current behavior?

    There is no implementation of Fixed Point.

    What is the new behavior?

    • implement Fixed Point Q5.26
    • Operations
    • unit testing

    Does this introduce a breaking change?

    • [ ] Yes
    • [X] No

    Other information

    opened by raphaelDkhn 0
  • 0️⃣ feat: relu

    0️⃣ feat: relu

    feat: Conv2D layer

    Pull Request type

    Please check the type of change your PR introduces:

    • [ ] Bugfix
    • [X] Feature
    • [ ] Code style update (formatting, renaming)
    • [ ] Refactoring (no functional changes, no API changes)
    • [ ] Build-related changes
    • [ ] Documentation content changes
    • [ ] Other (please describe):

    What is the current behavior?

    There is no implementation of ReLu.

    What is the new behavior?

    • function to perform ReLu
    • unit testing

    Does this introduce a breaking change?

    • [ ] Yes
    • [X] No

    Other information

    opened by raphaelDkhn 0
  • 🚀 feat: Conv2D layer

    🚀 feat: Conv2D layer

    feat: Conv2D layer

    Pull Request type

    Please check the type of change your PR introduces:

    • [ ] Bugfix
    • [X] Feature
    • [ ] Code style update (formatting, renaming)
    • [ ] Refactoring (no functional changes, no API changes)
    • [ ] Build-related changes
    • [ ] Documentation content changes
    • [ ] Other (please describe):

    What is the current behavior?

    There is no implementation of cross-correlation.

    What is the new behavior?

    • function to convolution 2D with multiple kernels (no padding yet)
    • unit testing

    Does this introduce a breaking change?

    • [ ] Yes
    • [X] No

    Other information

    opened by raphaelDkhn 0
  • ✍️ Document functions

    ✍️ Document functions

    Document functions

    Pull Request type

    Please check the type of change your PR introduces:

    • [ ] Bugfix
    • [ ] Feature
    • [ ] Code style update (formatting, renaming)
    • [ ] Refactoring (no functional changes, no API changes)
    • [ ] Build-related changes
    • [X] Documentation content changes
    • [ ] Other (please describe):

    What is the current behavior?

    Currently functions are not well documented.

    What is the new behavior?

    Document all functions following this template:

    • description
    • arguments
    • returns
    • panics

    Does this introduce a breaking change?

    • [ ] Yes
    • [X] No

    Other information

    opened by raphaelDkhn 0
  • ✨ refactor Matrix

    ✨ refactor Matrix

    refactor Matrix

    Pull Request type

    Please check the type of change your PR introduces:

    • [ ] Bugfix
    • [ ] Feature
    • [ ] Code style update (formatting, renaming)
    • [X] Refactoring (no functional changes, no API changes)
    • [ ] Build-related changes
    • [ ] Documentation content changes
    • [ ] Other (please describe):

    What is the current behavior?

    Currently matrix data was dissociate to MatrixShape struct .

    What is the new behavior?

    Refactoring Matrix, so a matrix is represented as a struct with the following fields:

    • rows (number of rows)
    • cols (number of columns)
    • data (the matrix' data)

    Does this introduce a breaking change?

    • [ ] Yes
    • [X] No

    Other information

    opened by raphaelDkhn 0
  • feat: Valid cross correlation 2d

    feat: Valid cross correlation 2d

    feat: valid cross correlation 2d

    Pull Request type

    Please check the type of change your PR introduces:

    • [ ] Bugfix
    • [X] Feature
    • [ ] Code style update (formatting, renaming)
    • [ ] Refactoring (no functional changes, no API changes)
    • [ ] Build-related changes
    • [ ] Documentation content changes
    • [ ] Other (please describe):

    What is the current behavior?

    There is no implementation of cross-correlation.

    What is the new behavior?

    • function to perform cross-correlation
    • function to perform slicing of matrix
    • function to perform dot product of two vectors
    • unit testing

    Does this introduce a breaking change?

    • [ ] Yes
    • [X] No

    Other information

    opened by raphaelDkhn 0
Owner
null
Simple neural network library for classification written in Rust.

Cogent A note I continue working on GPU stuff, I've made some interesting things there, but ultimately it made me realise this is far too monumental a

Jonathan Woollett-Light 41 Dec 25, 2022
Rust wrapper for the Fast Artificial Neural Network library

fann-rs Rust wrapper for the Fast Artificial Neural Network (FANN) library. This crate provides a safe interface to FANN on top of the low-level bindi

Andreas Fackler 12 Jul 17, 2022
A neural network, and tensor dynamic automatic differentiation implementation for Rust.

Corgi A neural network, and tensor dynamic automatic differentiation implementation for Rust. BLAS The BLAS feature can be enabled, and requires CBLAS

Patrick Song 20 Nov 7, 2022
Simple Neural Network on rust

Simple Artificial Neural Network A crate that implements simple usage of dense neural networks. Instalation Add this to your dependencies on Cargo.tom

null 6 Jul 1, 2022
Machine learning Neural Network in Rust

vinyana vinyana - stands for mind in pali language. Goal To implement a simple Neural Network Library in order to understand the maths behind it. This

Alexandru Olaru 3 Dec 26, 2022
SelfOrgMap 5 Nov 4, 2020
n2 is a library implementation of a feedforward, backpropagation artificial neural network.

n2 is a library implementation of a feedforward, backpropagation artificial neural network. Usage Add the following to the [dependencies] section o

Søren Mortensen 0 Feb 21, 2021
A light wheight Neural Network library with a focus on ease of use and speed.

Smarty Pants This goal of this library is to: Produce NeuralNetworks that will always give the same result when given the same input. Provide methods

Coding Wizard 3 Mar 7, 2022
A neural network model that can approximate any non-linear function by using the random search algorithm for the optimization of the loss function.

random_search A neural network model that can approximate any non-linear function by using the random search algorithm for the optimization of the los

ph04 2 Apr 1, 2022
A gpu accelerated (optional) neural network Rust crate.

Intricate A GPU accelerated library that creates/trains/runs neural networks in pure safe Rust code. Architechture overview Intricate has a layout ver

Gabriel Miranda 11 Dec 26, 2022
Neural network implementations from scratch in Rust.

Neural Network from Scratch Neural network implementations from scratch in Rust. Setup & Run Dataset used is mnist. Download the 4 archives and extrac

Mohammad Rahhal 6 Dec 29, 2022
A fun, hackable, GPU-accelerated, neural network library in Rust, written by an idiot

Tensorken: A Fun, Hackable, GPU-Accelerated, Neural Network library in Rust, Written by an Idiot (work in progress) Understanding deep learning from t

Kurt Schelfthout 44 May 6, 2023
An experimental Neural Network trainer/visualizer in Rust

DeepRender An experimental Neural Network trainer/visualizer in Rust Try it on your browser! https://msakuta.github.io/DeepRender/ Training on a funct

Masahiro Sakuta 6 Jun 12, 2023
The CBNF neural network header format.

cbnf The CBNF neural network header format. What is CBNF? CBNF is a neural network header format for use with efficiently updatable neural networks fo

Cosmo Bobak 2 Jul 11, 2023
Neural networks in Rust

deeplearn-rs Deep learning in Rust! This is my first shot at this. It's mostly just a proof of concept right now. The API will change. Status We have

Theodore DeRego 199 Oct 23, 2022
A simple neural net implementation.

PROPHET - Neural Network Library Linux Windows Codecov Coveralls Docs Crates.io A simple neural net implementation written in Rust with a focus on cac

Robin Freyler 41 Sep 16, 2022
Rust implementation of real-coded GA for solving optimization problems and training of neural networks

revonet Rust implementation of real-coded genetic algorithm for solving optimization problems and training of neural networks. The latter is also know

Yury Tsoy 19 Aug 11, 2022
Compile-time creation of neural networks with Rust

GAMMA Compile-time creation of neural networks with Rust Description This is for now just a showcase project of what can be done with const generics i

Aitor Ruano 354 Jan 1, 2023
Compile-time creation of neural networks

Mushin: Compile-time creation of neural networks Mushin is a Japanese term used in martial arts that refers to the state of mind obtained by practice.

Aitor Ruano 354 Jan 1, 2023