Skip to content

Commit

Permalink
GITBOOK-26: Fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
raphkhan authored and gitbook-bot committed Sep 18, 2023
1 parent 3523bed commit b996c50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,9 @@ struct Tensor<T> {
shape: Span<usize>,
data: Span<T>
}

struct ExtraParams {
fixed_point: Option<FixedImpl>
}

```

A `Tensor` in Orion takes a shape and a span array of the data and an extra parameter. In a 16x16 fixed-point format, there are 16 bits dedicated to the integer part of the number and 16 bits for the fractional part of the number. This format allows us to work with a wide range of values and a high degree of precision for conducting the OLS Tensor operations.
A `Tensor` in Orion takes a shape and a span array of the data. We work with a `Tensor<FP16x16>`. In a 16x16 fixed-point format, there are 16 bits dedicated to the integer part of the number and 16 bits for the fractional part of the number. This format allows us to work with a wide range of values and a high degree of precision for conducting the OLS Tensor operations.

### Implementing OLS functions using Orion

Expand Down
17 changes: 7 additions & 10 deletions docs/framework/operators/tensor/tensor.slice.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tensor.slice

```rust
```rust
fn slice(self: @Tensor<T>, starts: Span<usize>, ends: Span<usize>, axes: Option<Span<usize>>, steps: Option<Span<usize>>) -> Tensor<usize>;
```

Expand All @@ -9,18 +9,18 @@ Produces a slice of the input tensor along multiple axes.
## Args

* `self`(`@Tensor<T>`) - Tensor of data to extract slices from.
* `starts`(Span<usize>) - 1-D tensor of starting indices of corresponding axis in `axes`
* `ends`(Span<usize>) - 1-D tensor of ending indices (exclusive) of corresponding axis in `axes`
* `axes`(Option<Span<usize>>) - 1-D tensor of axes that `starts` and `ends` apply to.
* `steps`(Option<Span<usize>>) - 1-D tensor of slice step of corresponding axis in `axes`.
* `starts`(Span) - 1-D tensor of starting indices of corresponding axis in `axes`
* `ends`(Span) - 1-D tensor of ending indices (exclusive) of corresponding axis in `axes`
* `axes`(Option\<Span>) - 1-D tensor of axes that `starts` and `ends` apply to.
* `steps`(Option\<Span>) - 1-D tensor of slice step of corresponding axis in `axes`.

## Panics

* Panics if the length of starts is not equal to the length of ends.
* Panics if the length of starts is not equal to the length of axes.
* Panics if the length of starts is not equal to the length of steps.

## Returns
## Returns

A new `Tensor<T>` slice of the input tensor.

Expand All @@ -29,15 +29,12 @@ A new `Tensor<T>` slice of the input tensor.
```rust
use array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::core::{TensorTrait, Tensor, ExtraParams};
use orion::operators::tensor::implementations::impl_tensor_u32::{Tensor_u32};
use orion::numbers::fixed_point::core::{FixedType, FixedTrait, FixedImpl};
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};

fn slice_example() -> Tensor<u32> {
let tensor = TensorTrait::<u32>::new(
shape: array![2, 4].span(),
data: array![0, 1, 2, 3, 4, 5, 6, 7].span(),
extra: Option::None(())
);

return tensor.slice(
Expand Down

0 comments on commit b996c50

Please sign in to comment.