-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #426 from gizatechxyz/develop
Merge Develop into Main
- Loading branch information
Showing
297 changed files
with
9,780 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ target | |
__pycache__ | ||
|
||
neural_network/.venv | ||
|
||
Scarb.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,63 @@ | ||
# tensor.max | ||
|
||
```rust | ||
fn max(self: @Tensor<T>) -> T; | ||
fn max(tensors: Span<Tensor<T>>) -> Tensor<T>; | ||
``` | ||
|
||
Returns the maximum value in the tensor. | ||
Returns the element-wise maximum values from a list of input tensors | ||
The input tensors must have either: | ||
* Exactly the same shape | ||
* The same number of dimensions and the length of each dimension is either a common length or 1. | ||
|
||
## Args | ||
|
||
* `self`(`@Tensor<T>`) - The input tensor. | ||
* `tensors`(` Span<Tensor<T>>,`) - Array of the input tensors | ||
|
||
## Returns | ||
## Returns | ||
|
||
The maximum `T` value in the tensor. | ||
A new `Tensor<T>` containing the element-wise maximum values | ||
|
||
Examples | ||
## Panics | ||
|
||
* Panics if tensor array is empty | ||
* Panics if the shapes are not equal or broadcastable | ||
|
||
## Examples | ||
|
||
Case 1: Process tensors with same shape | ||
|
||
```rust | ||
use array::{ArrayTrait, SpanTrait}; | ||
|
||
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; | ||
|
||
fn max_example() -> u32 { | ||
let tensor = TensorTrait::new( | ||
shape: array![2, 2, 2].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7].span(), | ||
); | ||
fn max_example() -> Tensor<u32> { | ||
let tensor1 = TensorTrait::new(shape: array![2, 2].span(), data: array![0, 1, 2, 3].span(),); | ||
let tensor2 = TensorTrait::new(shape: array![2, 2].span(), data: array![0, 3, 1, 2].span(),); | ||
let result = TensorTrait::max(tensors: array![tensor1, tensor2].span()); | ||
return result; | ||
} | ||
>>> [0, 3, 2, 3] | ||
|
||
result.shape | ||
>>> (2, 2) | ||
``` | ||
|
||
Case 2: Process tensors with different shapes | ||
|
||
// We can call `max` function as follows. | ||
return tensor.max(); | ||
```rust | ||
use array::{ArrayTrait, SpanTrait}; | ||
|
||
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; | ||
|
||
fn max_example() -> Tensor<u32> { | ||
let tensor1 = TensorTrait::new(shape: array![2, 2].span(), data: array![0, 1, 2, 3].span(),); | ||
let tensor2 = TensorTrait::new(shape: array![1, 2].span(), data: array![1, 4].span(),); | ||
let result = TensorTrait::max(tensors: array![tensor1, tensor2].span()); | ||
return result; | ||
} | ||
>>> 7 | ||
>>> [1, 4, 2, 4] | ||
|
||
result.shape | ||
>>> (2, 2) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# tensor.max_in_tensor | ||
|
||
```rust | ||
fn max_in_tensor(self: @Tensor<T>) -> T; | ||
``` | ||
|
||
Returns the maximum value in the tensor. | ||
|
||
## Args | ||
|
||
* `self`(`@Tensor<T>`) - The input tensor. | ||
|
||
## Returns | ||
|
||
The maximum `T` value in the tensor. | ||
|
||
Examples | ||
|
||
```rust | ||
use array::{ArrayTrait, SpanTrait}; | ||
|
||
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; | ||
|
||
fn max_in_tensor_example() -> u32 { | ||
let tensor = TensorTrait::new( | ||
shape: array![2, 2, 2].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7].span(), | ||
); | ||
|
||
// We can call `max_in_tensor` function as follows. | ||
return tensor.max_in_tensor(); | ||
} | ||
>>> 7 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,63 @@ | ||
# tensor.min | ||
|
||
```rust | ||
fn min(self: @Tensor<T>) -> T; | ||
fn min(tensors: Span<Tensor<T>>) -> Tensor<T>; | ||
``` | ||
|
||
Returns the minimum value in the tensor. | ||
Returns the element-wise minumum values from a list of input tensors | ||
The input tensors must have either: | ||
* Exactly the same shape | ||
* The same number of dimensions and the length of each dimension is either a common length or 1. | ||
|
||
## Args | ||
|
||
* `self`(`@Tensor<T>`) - The input tensor. | ||
* `tensors`(` Span<Tensor<T>>,`) - Array of the input tensors | ||
|
||
## Returns | ||
## Returns | ||
|
||
The minimum `T` value in the tensor. | ||
A new `Tensor<T>` containing the element-wise minimum values | ||
|
||
## Panics | ||
|
||
* Panics if tensor array is empty | ||
* Panics if the shapes are not equal or broadcastable | ||
|
||
## Examples | ||
|
||
Case 1: Process tensors with same shape | ||
|
||
```rust | ||
use array::{ArrayTrait, SpanTrait}; | ||
|
||
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; | ||
|
||
fn min_example() -> u32 { | ||
let tensor = TensorTrait::new( | ||
shape: array![2, 2, 2].span(), | ||
data: array![0, 1, 2, 3, 4, 5, 6, 7].span(), | ||
); | ||
fn min_example() -> Tensor<u32> { | ||
let tensor1 = TensorTrait::new(shape: array![2, 2].span(), data: array![0, 1, 2, 3].span(),); | ||
let tensor2 = TensorTrait::new(shape: array![2, 2].span(), data: array![0, 3, 1, 2].span(),); | ||
let result = TensorTrait::min(tensors: array![tensor1, tensor2].span()); | ||
return result; | ||
} | ||
>>> [0, 1, 1, 2] | ||
|
||
result.shape | ||
>>> (2, 2) | ||
``` | ||
|
||
Case 2: Process tensors with different shapes | ||
|
||
// We can call `min` function as follows. | ||
return tensor.min(); | ||
```rust | ||
use array::{ArrayTrait, SpanTrait}; | ||
|
||
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; | ||
|
||
fn min_example() -> Tensor<u32> { | ||
let tensor1 = TensorTrait::new(shape: array![2, 2].span(), data: array![0, 1, 2, 3].span(),); | ||
let tensor2 = TensorTrait::new(shape: array![1, 2].span(), data: array![1, 4].span(),); | ||
let result = TensorTrait::min(tensors: array![tensor1, tensor2].span()); | ||
return result; | ||
} | ||
>>> 0 | ||
>>> [0, 1, 1, 4] | ||
|
||
result.shape | ||
>>> (2, 2) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# tensor.min_in_tensor | ||
|
||
```rust | ||
fn min_in_tensor(self: @Tensor<T>) -> T; | ||
``` | ||
|
||
Returns the minimum value in the tensor. | ||
|
||
## Args | ||
|
||
* `self`(`@Tensor<T>`) - The input tensor. | ||
|
||
## Returns | ||
|
||
The minimum `T` value in the tensor. | ||
|
||
## Examples | ||
|
||
```rust | ||
use array::{ArrayTrait, SpanTrait}; | ||
|
||
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; | ||
|
||
fn min_in_tensor_example() -> u32 { | ||
let tensor = TensorTrait::new( | ||
shape: array![2, 2, 2].span(), | ||
data: array![0, 1, 2, 3, 4, 5, 6, 7].span(), | ||
); | ||
|
||
// We can call `min_in_tensor` function as follows. | ||
return tensor.min_in_tensor(); | ||
} | ||
>>> 0 | ||
``` |
Oops, something went wrong.