tensor.ravel_index
fn ravel_index(self: @Tensor<T>, indices: Span<usize>) -> usize;Args
Panics
Returns
Examples
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
fn ravel_index_example() -> usize {
let tensor = TensorTrait::<u32>::new(
shape: array![2, 2, 2].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7].span(),
);
// We can call `ravel_index` function as follows.
return tensor.ravel_index(indices: array![1, 3, 0].span());
}
>>> 10
// This means that the value of indices [1,3,0]
// of a multidimensional array can be found at index 10 of Tensor.data.Last updated