pub trait Tensor<A, D>: RawTensor<A, D>where
    D: Dimension,{
Show 21 methods
    // Required methods
    fn from_shape_with_fn<Sh, F>(
        shape: Sh,
        f: F,
    ) -> Self::Container<Self::Repr, D>
       where Sh: ShapeBuilder<Dim = D>,
             F: FnMut(D::Pattern) -> A,
             Self: Sized;
    fn from_shape_with_value<Sh>(
        shape: Sh,
        value: A,
    ) -> Self::Container<Self::Repr, D>
       where Sh: ShapeBuilder<Dim = D>,
             Self: Sized;
    fn data(&self) -> &Self::Container<Self::Repr, D>;
    fn data_mut(&mut self) -> &mut Self::Container<Self::Repr, D>;
    fn dim(&self) -> D::Pattern;
    fn raw_dim(&self) -> D;
    fn shape(&self) -> &[usize];
    fn apply<F, B>(&self, f: F) -> Self::Container<OwnedRepr<B>, D>
       where F: FnMut(A) -> B;
    fn apply_mut<F>(&mut self, f: F)
       where Self::Repr: DataMut,
             F: FnMut(A) -> A;
    fn axis_iter(&self, axis: usize) -> AxisIter<'_, A, D::Smaller>
       where D: RemoveAxis;
    fn iter(&self) -> Iter<'_, A, D>;
    fn iter_mut(&mut self) -> IterMut<'_, A, D>
       where Self::Repr: DataMut;
    // Provided methods
    fn default<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
       where Sh: ShapeBuilder<Dim = D>,
             Self: Sized,
             A: Default { ... }
    fn ones<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
       where Sh: ShapeBuilder<Dim = D>,
             Self: Sized,
             A: Clone + One { ... }
    fn zeros<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
       where Sh: ShapeBuilder<Dim = D>,
             Self: Sized,
             A: Clone + Zero { ... }
    fn mean(&self) -> A
       where A: Scalar { ... }
    fn set_data(&mut self, data: Self::Container<Self::Repr, D>) -> &mut Self { ... }
    fn sum(&self) -> A
       where A: Clone + Sum { ... }
    fn pow2(&self) -> Self::Container<OwnedRepr<A>, D>
       where A: Scalar { ... }
    fn abs(&self) -> Self::Container<OwnedRepr<A>, D>
       where A: Signed { ... }
    fn neg(&self) -> Self::Container<OwnedRepr<A>, D>
       where A: Neg<Output = A> { ... }
}Expand description
Required Methods§
Sourcefn from_shape_with_fn<Sh, F>(shape: Sh, f: F) -> Self::Container<Self::Repr, D>
 
fn from_shape_with_fn<Sh, F>(shape: Sh, f: F) -> Self::Container<Self::Repr, D>
Create a new tensor with the given shape and a function to fill it
Sourcefn from_shape_with_value<Sh>(
    shape: Sh,
    value: A,
) -> Self::Container<Self::Repr, D>where
    Sh: ShapeBuilder<Dim = D>,
    Self: Sized,
 
fn from_shape_with_value<Sh>(
    shape: Sh,
    value: A,
) -> Self::Container<Self::Repr, D>where
    Sh: ShapeBuilder<Dim = D>,
    Self: Sized,
Create a new tensor with the given shape and value
Sourcefn data(&self) -> &Self::Container<Self::Repr, D>
 
fn data(&self) -> &Self::Container<Self::Repr, D>
returns a reference to the data of the object
Sourcefn data_mut(&mut self) -> &mut Self::Container<Self::Repr, D>
 
fn data_mut(&mut self) -> &mut Self::Container<Self::Repr, D>
returns a mutable reference to the data of the object
Sourcefn apply<F, B>(&self, f: F) -> Self::Container<OwnedRepr<B>, D>where
    F: FnMut(A) -> B,
 
fn apply<F, B>(&self, f: F) -> Self::Container<OwnedRepr<B>, D>where
    F: FnMut(A) -> B,
returns a new tensor with the same shape as the object and the given function applied to each element
Sourcefn apply_mut<F>(&mut self, f: F)
 
fn apply_mut<F>(&mut self, f: F)
returns a new tensor with the same shape as the object and the given function applied
fn axis_iter(&self, axis: usize) -> AxisIter<'_, A, D::Smaller>where
    D: RemoveAxis,
fn iter(&self) -> Iter<'_, A, D>
fn iter_mut(&mut self) -> IterMut<'_, A, D>
Provided Methods§
Sourcefn default<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
 
fn default<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
Create a new tensor with the given shape and all values set to their default
Sourcefn ones<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
 
fn ones<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
create a new tensor with the given shape and all values set to one
Sourcefn zeros<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
 
fn zeros<Sh>(shape: Sh) -> Self::Container<Self::Repr, D>
create a new tensor with the given shape and all values set to zero
fn mean(&self) -> Awhere
    A: Scalar,
Sourcefn set_data(&mut self, data: Self::Container<Self::Repr, D>) -> &mut Self
 
fn set_data(&mut self, data: Self::Container<Self::Repr, D>) -> &mut Self
sets the data of the object and returns a mutable reference to the object
fn sum(&self) -> A
fn pow2(&self) -> Self::Container<OwnedRepr<A>, D>where
    A: Scalar,
fn abs(&self) -> Self::Container<OwnedRepr<A>, D>where
    A: Signed,
fn neg(&self) -> Self::Container<OwnedRepr<A>, D>where
    A: Neg<Output = A>,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.