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.

Orion supports Cairo and Scarb v2.4.0

📦 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.

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

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

Last updated