Skip to content

Latest commit

 

History

History
82 lines (53 loc) · 2.76 KB

get-started.md

File metadata and controls

82 lines (53 loc) · 2.76 KB

Get Started

In this section, we will guide you to start using Orion successfully. We will help you install Cairo 1.0 and add Orion dependency in your project.

{% hint style="info" %} Orion supports Cairo and Scarb v2.4.0 {% endhint %}

📦 Installations

Install Cairo

Step 1: Install Cairo

There are different ways to install Cairo. Use the one that suits you best: Cairo installer.

Step 2: Setup Language Server

Install the Cairo 1 VS Code Extension for proper syntax highlighting and code navigation. Just follow the steps indicated here.

Install the Cairo package manager Scarb

Step 1: Install Scarb

Follow the installation guide on the Scarb's Website.

Step 2: Create a new Scarb project

Follow the instructions here to start a new Scarb project.

⚙️ Add orion dependency in your project

If your Scarb.toml doesn't already have a [dependencies] section, add it, then list the package name and the URL to its Git repository.

{% code title="Scarb.toml" %}

[dependencies]
orion = { git = "https://github.com/gizatechxyz/onnx-cairo" }

{% endcode %}

Now, run scarb build, and Scarb will fetch orion dependency and all its dependencies. Then it will compile your package with all of these packages included:

scarb build

You can now use the orion in your files:

use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, I32Tensor};
use orion::operators::nn::{NNTrait, I32NN};

fn relu_example() -> Tensor<i32> {
    let tensor = TensorTrait::<i32>::new(
        shape: array![2, 2].span(),
        data: array![
            IntegerTrait::new(1, false),
            IntegerTrait::new(2, false),
            IntegerTrait::new(1, true),
            IntegerTrait::new(2, true),
        ]
            .span(),
    );

    return NNTrait::relu(@tensor);
}

🔭 Discover the Orion APIs

⚙️ OperatorsA set of standardized math functions that are used in the computation of neural network models.operators
🔢 NumbersA full implementation of Signed Integer and Fixed Point in Cairo.numbers