pub struct Tensor<T> { /* fields omitted */ }
Expand description
A multidimensional array with copy-on-write semantics.
pub fn single(value: T) -> Self
pub fn rank(&self) -> usize
The number of dimensions this Tensor
has.
Get an immutable reference to the underlying elements in this
Tensor
.
Get a mutable reference to the underlying elements in this Tensor
.
pub fn map<F, Out>(&self, map: F) -> Tensor<Out> where
F: FnMut(&[usize], &T) -> Out,
Create a new Tensor
by applying a function to every element in the
current tensor.
This is often an expensive operation.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
fn from(array: &'a [T]) -> Self
impl<Element: Clone, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize, const F: usize, const G: usize, const H: usize> From<[[[[[[[[Element; H]; G]; F]; E]; D]; C]; B]; A]> for Tensor<Element>
fn from(array: [[[[[[[[Element; H]; G]; F]; E]; D]; C]; B]; A]) -> Self
impl<Element: Clone, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize, const F: usize, const G: usize> From<[[[[[[[Element; G]; F]; E]; D]; C]; B]; A]> for Tensor<Element>
fn from(array: [[[[[[[Element; G]; F]; E]; D]; C]; B]; A]) -> Self
impl<Element: Clone, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize, const F: usize> From<[[[[[[Element; F]; E]; D]; C]; B]; A]> for Tensor<Element>
fn from(array: [[[[[[Element; F]; E]; D]; C]; B]; A]) -> Self
impl<Element: Clone, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize> From<[[[[[Element; E]; D]; C]; B]; A]> for Tensor<Element>
fn from(array: [[[[[Element; E]; D]; C]; B]; A]) -> Self
impl<Element: Clone, const A: usize, const B: usize, const C: usize, const D: usize> From<[[[[Element; D]; C]; B]; A]> for Tensor<Element>
fn from(array: [[[[Element; D]; C]; B]; A]) -> Self
impl<T: Clone, const WIDTH: usize, const HEIGHT: usize, const DEPTH: usize> From<[[[T; WIDTH]; HEIGHT]; DEPTH]> for Tensor<T>
fn from(array: [[[T; WIDTH]; HEIGHT]; DEPTH]) -> Self
impl<T: Clone, const WIDTH: usize, const HEIGHT: usize> From<[[T; WIDTH]; HEIGHT]> for Tensor<T>
fn from(array: [[T; WIDTH]; HEIGHT]) -> Self
impl<T, const N: usize> From<[T; N]> for Tensor<T>
fn from(array: [T; N]) -> Self
fn eq(&self, other: &[T; N]) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
fn eq(&self, other: &[T]) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
Serialize this value into the given Serde serializer. Read more
Get an array containing the Shape
for each Tensor
in this tuple.
Get an array containing pointers to the elements of each Tensor
in
this tuple. Read more
Create a new set of empty tensors with the specified shape. Read more
Get a set of mutable pointers into each tensor’s backing buffer.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.