-
Notifications
You must be signed in to change notification settings - Fork 81
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 #443 from gizatechxyz/develop
Merge Develop into Main
- Loading branch information
Showing
757 changed files
with
15,732 additions
and
1,640 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
Empty file.
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,44 @@ | ||
#tensor.bitwise_and | ||
|
||
```rust | ||
fn bitwise_and(self: @Tensor<T>, other: @Tensor<T>) -> Tensor<usize>; | ||
``` | ||
|
||
Computes the bitwise AND of two tensors element-wise. | ||
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 first tensor to be compared | ||
* `other`(`@Tensor<T>`) - The second tensor to be compared | ||
|
||
## Panics | ||
|
||
* Panics if the shapes are not equal or broadcastable | ||
|
||
## Returns | ||
|
||
A new `Tensor<T>` with the same shape as the broadcasted inputs. | ||
|
||
## Example | ||
|
||
```rust | ||
use array::{ArrayTrait, SpanTrait}; | ||
|
||
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; | ||
|
||
fn and_example() -> Tensor<usize> { | ||
let tensor_1 = TensorTrait::<u32>::new( | ||
shape: array![3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), | ||
); | ||
|
||
let tensor_2 = TensorTrait::<u32>::new( | ||
shape: array![3, 3].span(), data: array![0, 1, 2, 0, 4, 5, 0, 6, 2].span(), | ||
); | ||
|
||
return tensor_1.bitwise_and(@tensor_2); | ||
} | ||
>>> [0,1,2,0,4,5,0,6,2] | ||
``` |
38 changes: 38 additions & 0 deletions
38
docs/framework/operators/tensor/tensor.constant_of_shape.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,38 @@ | ||
# tensor.constant_of_shape | ||
|
||
```rust | ||
fn constant_of_shape(shape: Span<usize>, value: T) -> Tensor<T>; | ||
``` | ||
|
||
Returns a new tensor with the given shape and constant value. | ||
|
||
## Args | ||
|
||
* `shape`(`Span<usize>`) - A span representing the shape of the tensor. | ||
* `value` (`T`) - the constant value. | ||
|
||
## Returns | ||
|
||
A new `Tensor<T>` instance. | ||
|
||
## Examples | ||
|
||
Let's create new u32 Tensor with constant 42. | ||
|
||
```rust | ||
use array::{ArrayTrait, SpanTrait}; | ||
|
||
use orion::operators::tensor::{ | ||
TensorTrait, // we import the trait | ||
Tensor, // we import the type | ||
U32Tensor // we import the implementation. | ||
}; | ||
|
||
fn constant_of_shape_example() -> Tensor<u32> { | ||
let tensor = TensorTrait::constant_of_shape(shape: array![3].span(), value: 42); | ||
|
||
return tensor; | ||
} | ||
|
||
>>> [42, 42, 42] | ||
``` |
Oops, something went wrong.