-
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 #590 from gizatechxyz/develop
Merge Develop into Mains
- Loading branch information
Showing
367 changed files
with
6,852 additions
and
6,648 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
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
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
23 changes: 23 additions & 0 deletions
23
docs/framework/operators/machine-learning/normalizer/README.md
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,23 @@ | ||
# Normalizer | ||
|
||
`NormalizerTrait` computes the normalization of the input, each row of the input is normalized independently. | ||
|
||
```rust | ||
use orion::operators::ml::NormalizerTrait; | ||
``` | ||
|
||
### Data types | ||
|
||
Orion supports currently only fixed point data types for `NormalizerTrait`. | ||
|
||
| Data type | dtype | | ||
| -------------------- | ------------------------------------------------------------- | | ||
| Fixed point (signed) | `NormalizerTrait<FP8x23 \| FP16x16 \| FP64x64 \| FP32x32>` | | ||
|
||
|
||
*** | ||
|
||
| function | description | | ||
| --- | --- | | ||
| [`normalizer.predict`](normalizer.predict.md) | Returns the normalization of the input, each row of the input is normalized independently. | | ||
|
61 changes: 61 additions & 0 deletions
61
docs/framework/operators/machine-learning/normalizer/normalizer.predict.md
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,61 @@ | ||
# Normalizer::predict | ||
|
||
```rust | ||
fn predict(X: Tensor<T>, norm: NORM) -> Tensor<T>; | ||
``` | ||
|
||
Returns the normalized input. | ||
Tree different types of normalization can be performed and are defined as follow : | ||
MAX: $Y = \frac{X}{max(X)}$ | ||
L1: $Y = \frac{X}{sum(X)}$ | ||
L2: $Y = \frac{X}\sqrt{{sum(X²)}}$ | ||
For batches, that is, [N,C] tensors, normalization is done along the C axis. In other words, each row of the batch is normalized independently. | ||
|
||
## Args | ||
|
||
* `X`(`@Tensor<T>`) - Input 2D tensor. | ||
* `norm`(`NORM`) - NORM::MAX, NORM::L1 or NORM::L2 | ||
|
||
|
||
## Returns | ||
|
||
* Tensor<T> - output tensor | ||
|
||
## Examples | ||
|
||
```rust | ||
use orion::numbers::FP16x16; | ||
use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor, FP16x16TensorDiv, FP16x16TensorPartialEq}; | ||
|
||
use orion::operators::ml::normalizer::normalizer::{ | ||
NormalizerTrait, NORM | ||
}; | ||
|
||
|
||
|
||
fn normalizer_max() -> Tensor<FP16x16> { | ||
let mut shape = ArrayTrait::<usize>::new(); | ||
shape.append(3); | ||
shape.append(3); | ||
|
||
let mut data = ArrayTrait::new(); | ||
data.append(FP16x16 { mag: 65536, sign: true }); | ||
data.append(FP16x16 { mag: 52428, sign: true }); | ||
data.append(FP16x16 { mag: 39321, sign: true }); | ||
data.append(FP16x16 { mag: 26214, sign: true }); | ||
data.append(FP16x16 { mag: 13107, sign: true }); | ||
data.append(FP16x16 { mag: 0, sign: false }); | ||
data.append(FP16x16 { mag: 13107, sign: false }); | ||
data.append(FP16x16 { mag: 26214, sign: false }); | ||
data.append(FP16x16 { mag: 39321, sign: false }); | ||
|
||
let X = TensorTrait::new(shape.span(), data.span()); | ||
|
||
return NormalizerTrait::predict(X, NORM::MAX); | ||
} | ||
>>> [[-1. -0.8 -0.6 ] | ||
[-1. -0.5 0. ] | ||
[ 0.3333333 0.6666666 1. ]] | ||
|
||
``` | ||
|
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,4 +1,3 @@ | ||
|
||
# NNTrait::col2im | ||
|
||
```rust | ||
|
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
Empty file.
Oops, something went wrong.