Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Commit db3b766

Browse files
committed
revert to fb6f4a
1 parent 215cc80 commit db3b766

File tree

489 files changed

+3907
-6252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

489 files changed

+3907
-6252
lines changed

.DS_Store

6 KB
Binary file not shown.

Scarb.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "orion"
3-
version = "0.2.5"
4-
cairo-version = "2.6.3"
3+
version = "0.2.4"
4+
cairo-version = "2.5.3"
55
edition = "2023_10"
66
description = "ONNX Runtime in Cairo for verifiable ML inference using STARK"
77
homepage = "https://github.com/gizatechxyz/orion"

docs/framework/operators/tensor/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ use orion::operators::tensor::TensorTrait;
5555
| [`tensor.min_in_tensor`](tensor.min\_in\_tensor.md) | Returns the minimum value in the tensor. |
5656
| [`tensor.min`](tensor.min.md) | Returns the minimum value in the tensor. |
5757
| [`tensor.max`](tensor.max.md) | Returns the maximum value in the tensor. |
58-
| [`tensor.reduce_sum`](tensor.reduce\_sum.md) | Computes the sum of the input tensor's elements along the provided axes. |
59-
| [`tensor.reduce_sum_single_axis`](tensor.reduce\_sum\_single\_axis.md) | Reduces a tensor by summing its elements along a specified axis. |
58+
| [`tensor.reduce_sum`](tensor.reduce\_sum.md) | Reduces a tensor by summing its elements along a specified axis. |
6059
| [`tensor.reduce_prod`](tensor.reduce\_prod.md) | Reduces a tensor to its products along specified axis. |
6160
| [`tensor.argmax`](tensor.argmax.md) | Returns the index of the maximum value along the specified axis. |
6261
| [`tensor.argmin`](tensor.argmin.md) | Returns the index of the minimum value along the specified axis. |

docs/framework/operators/tensor/tensor.and.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tensor.and
22

33
```rust
4-
fn and(self: @Tensor<bool>, other: @Tensor<bool>) -> Tensor<i32>;
4+
fn and(self: @Tensor<bool>, other: @Tensor<bool>) -> Tensor<bool>;
55
```
66

77
Computes the logical AND of two tensors element-wise.
@@ -20,7 +20,7 @@ The input tensors must have either:
2020

2121
## Returns
2222

23-
A new `Tensor<i32>` with the same shape as the broadcasted inputs.
23+
A new `Tensor<bool>` with the same shape as the broadcasted inputs.
2424

2525
## Examples
2626

@@ -29,7 +29,7 @@ use core::array::{ArrayTrait, SpanTrait};
2929

3030
use orion::operators::tensor::{TensorTrait, Tensor, BoolTensor};
3131

32-
fn and_example() -> Tensor<i32> {
32+
fn and_example() -> Tensor<bool> {
3333
let tensor_1 = TensorTrait::<bool>::new(
3434
shape: array![3, 3].span(), data: array![false, true, false, false, false, true, true, false, true, false, false, true].span(),
3535
);

docs/framework/operators/tensor/tensor.equal.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tensor.equal
22

33
```rust
4-
fn equal(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<i32>;
4+
fn equal(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<usize>;
55
```
66

77
Check if two tensors are equal element-wise.
@@ -20,7 +20,7 @@ The input tensors must have either:
2020

2121
## Returns
2222

23-
A new `Tensor<i32>` (1 if equal, 0 otherwise) with the same shape as the broadcasted inputs.
23+
A new `Tensor<usize>` of booleans (1 if equal, 0 otherwise) with the same shape as the broadcasted inputs.
2424

2525
## Examples
2626

@@ -31,7 +31,7 @@ use core::array::{ArrayTrait, SpanTrait};
3131

3232
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
3333

34-
fn eq_example() -> Tensor<i32> {
34+
fn eq_example() -> Tensor<usize> {
3535
let tensor_1 = TensorTrait::<u32>::new(
3636
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
3737
);
@@ -43,7 +43,7 @@ fn eq_example() -> Tensor<i32> {
4343
// We can call `equal` function as follows.
4444
return tensor_1.equal(@tensor_2);
4545
}
46-
>>> [true,true,true,true,true,false,false,false]
46+
>>> [1,1,1,1,1,0,0,0]
4747
```
4848

4949
Case 2: Compare tensors with different shapes
@@ -53,7 +53,7 @@ use core::array::{ArrayTrait, SpanTrait};
5353

5454
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
5555

56-
fn eq_example() -> Tensor<i32> {
56+
fn eq_example() -> Tensor<usize> {
5757
let tensor_1 = TensorTrait::<u32>::new(
5858
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
5959
);
@@ -63,5 +63,5 @@ fn eq_example() -> Tensor<i32> {
6363
// We can call `equal` function as follows.
6464
return tensor_1.equal(@tensor_2);
6565
}
66-
>>> [true,true,true,false,false,false,false,false,false]
66+
>>> [1,1,1,0,0,0,0,0,0]
6767
```

docs/framework/operators/tensor/tensor.greater.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tensor.greater
22

33
```rust
4-
fn greater(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<i32>;
4+
fn greater(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<usize>;
55
```
66

77
Check if each element of the first tensor is greater than the corresponding element of the second tensor.
@@ -20,7 +20,7 @@ The input tensors must have either:
2020

2121
## Returns
2222

23-
A new `Tensor<i32>` of booleans (0 or 1) with the same shape as the broadcasted inputs.
23+
A new `Tensor<usize>` of booleans (0 or 1) with the same shape as the broadcasted inputs.
2424

2525
## Examples
2626

@@ -31,7 +31,7 @@ use core::array::{ArrayTrait, SpanTrait};
3131

3232
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
3333

34-
fn greater_example() -> Tensor<i32> {
34+
fn greater_example() -> Tensor<usize> {
3535
let tensor_1 = TensorTrait::<u32>::new(
3636
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
3737
);
@@ -53,7 +53,7 @@ use core::array::{ArrayTrait, SpanTrait};
5353

5454
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
5555

56-
fn greater_example() -> Tensor<i32> {
56+
fn greater_example() -> Tensor<usize> {
5757
let tensor_1 = TensorTrait::<u32>::new(
5858
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
5959
);

docs/framework/operators/tensor/tensor.greater_equal.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tensor.greater_equal
22

33
```rust
4-
fn greater_equal(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<i32>;
4+
fn greater_equal(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<usize>;
55
```
66

77
Check if each element of the first tensor is greater than or equal to the corresponding element of the second tensor.
@@ -31,7 +31,7 @@ use core::array::{ArrayTrait, SpanTrait};
3131

3232
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
3333

34-
fn greater_equal_example() -> Tensor<i32> {
34+
fn greater_equal_example() -> Tensor<usize> {
3535
let tensor_1 = TensorTrait::<u32>::new(
3636
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
3737
);
@@ -53,7 +53,7 @@ use core::array::{ArrayTrait, SpanTrait};
5353

5454
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
5555

56-
fn greater_equal_example() -> Tensor<i32> {
56+
fn greater_equal_example() -> Tensor<usize> {
5757
let tensor_1 = TensorTrait::<u32>::new(
5858
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
5959
);

docs/framework/operators/tensor/tensor.is_inf.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## tensor.is_inf
22

33
```rust
4-
fn is_inf(self: @Tensor<T>, detect_negative: Option<u8>, detect_positive: Option<u8>) -> Tensor<usize>;
4+
fn is_inf(self: @Tensor<T>, detect_negative: Option<u8>, detect_positive: Option<u8>) -> Tensor<bool>;
55
```
66

77
Maps infinity to true and other values to false.
@@ -23,7 +23,7 @@ A new `Tensor<bool>` instance with entries set to true iff the input tensors cor
2323
use core::array::{ArrayTrait, SpanTrait};
2424
use orion::operators::tensor::{BoolTensor, TensorTrait, Tensor, U32Tensor};
2525

26-
fn is_inf_example() -> Tensor<usize> {
26+
fn is_inf_example() -> Tensor<bool> {
2727
let tensor = TensorTrait::<u32>::new(
2828
shape: array![6].span(), data: array![1, 0, NumberTrait::INF(), 8, NumberTrait::INF(), NumberTrait::INF()].span(),
2929
);

docs/framework/operators/tensor/tensor.is_nan.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## tensor.is_nan
22

33
```rust
4-
fn is_nan(self: @Tensor<T>) -> Tensor<usize>;
4+
fn is_nan(self: @Tensor<T>) -> Tensor<bool>;
55
```
66

77
Maps NaN to true and other values to false.
@@ -21,7 +21,7 @@ use core::array::{ArrayTrait, SpanTrait};
2121
use orion::operators::tensor::{BoolTensor, TensorTrait, Tensor, FP8x23Tensor};
2222
use orion::numbers::{FixedTrait, FP8x23};
2323

24-
fn is_nan_example() -> Tensor<usize> {
24+
fn is_nan_example() -> Tensor<bool> {
2525
let mut shape = ArrayTrait::<usize>::new();
2626
shape.append(4);
2727

docs/framework/operators/tensor/tensor.less.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tensor.less
22

33
```rust
4-
fn less(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<i32>;
4+
fn less(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<usize>;
55
```
66

77
Check if each element of the first tensor is less than the corresponding element of the second tensor.
@@ -31,7 +31,7 @@ use core::array::{ArrayTrait, SpanTrait};
3131

3232
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
3333

34-
fn less_example() -> Tensor<i32> {
34+
fn less_example() -> Tensor<usize> {
3535
let tensor_1 = TensorTrait::<u32>::new(
3636
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
3737
);
@@ -53,7 +53,7 @@ use core::array::{ArrayTrait, SpanTrait};
5353

5454
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
5555

56-
fn less_example() -> Tensor<i32> {
56+
fn less_example() -> Tensor<usize> {
5757
let tensor_1 = TensorTrait::<u32>::new(
5858
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
5959
);
@@ -63,5 +63,5 @@ fn less_example() -> Tensor<i32> {
6363
// We can call `less` function as follows.
6464
return tensor_1.less(@tensor_2);
6565
}
66-
>>> [false,false,false,false,false,false,false,true,true]
66+
>>> [0,0,0,0,0,0,0,1,1]
6767
```

docs/framework/operators/tensor/tensor.less_equal.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tensor.less_equal
22

33
```rust
4-
fn less_equal(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<i32>;
4+
fn less_equal(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<usize>;
55
```
66

77
Check if each element of the first tensor is less than or equal to the corresponding element of the second tensor.
@@ -31,7 +31,7 @@ use core::array::{ArrayTrait, SpanTrait};
3131

3232
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
3333

34-
fn less_equal_example() -> Tensor<i32> {
34+
fn less_equal_example() -> Tensor<usize> {
3535
let tensor_1 = TensorTrait::<u32>::new(
3636
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
3737
);
@@ -53,7 +53,7 @@ use core::array::{ArrayTrait, SpanTrait};
5353

5454
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
5555

56-
fn less_equal_example() -> Tensor<i32> {
56+
fn less_equal_example() -> Tensor<usize> {
5757
let tensor_1 = TensorTrait::<u32>::new(
5858
shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
5959
);

docs/framework/operators/tensor/tensor.not.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tensor.not
22

33
```rust
4-
fn not(self: @Tensor<bool>) -> Tensor<bool>;
4+
fn not(self: @Tensor<bool>) -> Tensor<bool;
55
```
66

77
Computes the negation of the elements in the bool type input tensor.

docs/framework/operators/tensor/tensor.or.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tensor.or
22

33
```rust
4-
fn or(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<i32>;
4+
fn or(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<usize>;
55
```
66

77
Computes the logical OR of two tensors element-wise.
@@ -20,7 +20,7 @@ The input tensors must have either:
2020

2121
## Returns
2222

23-
A new `Tensor<i32>` (0 or 1) with the same shape as the broadcasted inputs.
23+
A new `Tensor<usize>` of booleans (0 or 1) with the same shape as the broadcasted inputs.
2424

2525
## Examples
2626

@@ -31,7 +31,7 @@ use core::array::{ArrayTrait, SpanTrait};
3131

3232
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
3333

34-
fn or_example() -> Tensor<i32> {
34+
fn or_example() -> Tensor<usize> {
3535
let tensor_1 = TensorTrait::<u32>::new(
3636
shape: array![3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
3737
);
@@ -52,7 +52,7 @@ use core::array::{ArrayTrait, SpanTrait};
5252

5353
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
5454

55-
fn or_example() -> Tensor<i32> {
55+
fn or_example() -> Tensor<usize> {
5656
let tensor_1 = TensorTrait::<u32>::new(
5757
shape: array![3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(),
5858
);

docs/framework/operators/tensor/tensor.reduce_sum.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
fn reduce_sum(self: @Tensor<T>, axis: usize, keepdims: bool) -> Tensor<T>;
55
```
66

7-
Computes the sum of the input tensor's elements along the provided axes
7+
Reduces a tensor by summing its elements along a specified axis.
88

99
## Args
1010

1111
* `self`(`@Tensor<T>`) - The input tensor.
12-
* `axes`(`Option<Span<usize>>`) - Optional input list of integers, along which to reduce.
13-
* `keepdims`(`Option<bool>`) - If true, retains reduced dimensions with length 1.
14-
* `noop_with_empty_axes`(`Option<bool>`) - Defines behavior if 'axes' is empty. Default behavior with 'false' is to reduce all axes. When axes is empty and this attribute is set to true, input tensor will not be reduced,and the output tensor would be equivalent to input tensor.
12+
* `axis`(`usize`) - The dimension to reduce.
13+
* `keepdims`(`bool`) - If true, retains reduced dimensions with length 1.
1514

1615
## Panics
1716

@@ -30,11 +29,11 @@ use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
3029

3130
fn reduce_sum_example() -> Tensor<u32> {
3231
let tensor = TensorTrait::<u32>::new(
33-
shape: array![3, 2, 2].span(), data: array![1, 2, 3, 4, 5, 6, 7, 8 ,9, 10, 11, 12].span(),
32+
shape: array![2, 2, 2].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7].span(),
3433
);
3534

3635
// We can call `reduce_sum` function as follows.
37-
return tensor.reduce_sum(Option::Some(array![1].span()), Option::Some(false), Option::None);
36+
return tensor.reduce_sum(axis: 0, keepdims: false);
3837
}
39-
>>> [[4, 6] [12, 14] [20, 22]]
38+
>>> [[4,6],[8,10]]
4039
```

docs/framework/operators/tensor/tensor.reduce_sum_single_axis.md

-39
This file was deleted.

docs/framework/operators/tensor/tensor.reshape.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# tensor.reshape
22

33
```rust
4-
fn reshape(self: @Tensor<T>, target_shape: Span<i32>) -> Tensor<T>;
4+
fn reshape(self: @Tensor<T>, target_shape: Span<usize>) -> Tensor<T>;
55
```
66

77
Returns a new tensor with the specified target shape and the same data as the input tensor.
88

99
## Args
1010

1111
* `self`(`@Tensor<T>`) - The input tensor.
12-
* `target_shape`(Span<i32>) - A span containing the target shape of the tensor.
12+
* `target_shape`(Span<usize>) - A span containing the target shape of the tensor.
1313

1414
## Panics
1515

0 commit comments

Comments
 (0)