Struct acme_tensor::TensorBase

source ·
pub struct TensorBase<T = f64> { /* private fields */ }

Implementations§

source§

impl<T> TensorBase<T>

source

pub fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = T>,

Create a new tensor from an iterator.

source

pub fn from_scalar(value: T) -> Self

Create a new tensor from a scalar value.

source

pub fn from_shape_iter<I>(shape: impl IntoShape, iter: I) -> Self
where I: IntoIterator<Item = T>,

Create a new tensor from an iterator, with a particular shape.

source

pub fn from_shape_vec(shape: impl IntoShape, data: Vec<T>) -> Self

Create a new tensor from a Vec, with a specified shape.

source

pub fn from_vec(data: Vec<T>) -> Self

Create a new, one-dimensional tensor from a Vec.

source

pub fn as_mut_ptr(&mut self) -> *mut T

Return a mutable pointer to the tensor’s data.

source

pub fn as_ptr(&self) -> *const T

Return a pointer to the tensor’s data.

source

pub fn as_slice(&self) -> &[T]

Return a reference to the tensor’s data.

source

pub fn as_mut_slice(&mut self) -> &mut [T]

Return a mutable reference to the tensor’s data.

source

pub fn assign(&mut self, other: &Self)
where T: Clone,

Assign the values of another tensor to this tensor.

source

pub fn detach(&self) -> Self
where T: Clone,

Detach the computational graph from the tensor

source

pub fn first(&self) -> Option<&T>

Returns a reference to the first element of the tensor.

source

pub fn first_mut(&mut self) -> Option<&mut T>

Returns a mutable reference to the first element of the tensor.

source

pub fn get(&self, index: impl AsRef<[usize]>) -> Option<&T>

Returns the data at the specified index.

source

pub fn get_mut(&mut self, index: impl AsRef<[usize]>) -> Option<&mut T>

Returns a mutable reference to the data at the specified index.

source

pub const fn id(&self) -> TensorId

Returns the unique identifier of the tensor.

source

pub fn is_contiguous(&self) -> bool

Returns true if the tensor is contiguous.

source

pub fn is_empty(&self) -> bool

Returns true if the tensor is empty.

source

pub fn is_scalar(&self) -> bool

A function to check if the tensor is a scalar

source

pub fn is_square(&self) -> bool

Returns true if the tensor is a square matrix.

source

pub const fn is_variable(&self) -> bool

A function to check if the tensor is a variable

source

pub fn iter(&self) -> Iter<'_, T>

Return an iterator over the tensor

source

pub const fn kind(&self) -> TensorKind

Get the kind of the tensor

source

pub fn last(&self) -> Option<&T>

Get a reference to the last element of the tensor

source

pub fn last_mut(&mut self) -> Option<&mut T>

Get a mutable reference to the last element of the tensor

source

pub const fn layout(&self) -> &Layout

Get a reference to the Layout of the tensor

source

pub fn ncols(&self) -> usize

Get the number of columns in the tensor

source

pub fn nrows(&self) -> usize

Get the number of rows in the tensor

source

pub const fn op(&self) -> &BackpropOp<T>

Get a reference to the operation of the tensor

source

pub fn op_view(&self) -> BackpropOp<&T>

Get a reference to the operation of the tensor

source

pub fn rank(&self) -> Rank

Get an owned reference to the Rank of the tensor

source

pub fn set(&mut self, index: impl AsRef<[usize]>, value: T)

Set the value of the tensor at the specified index

source

pub fn shape(&self) -> &Shape

An owned reference of the tensors Shape

source

pub fn size(&self) -> usize

Returns the number of elements in the tensor.

source

pub fn strides(&self) -> &Stride

Get a reference to the stride of the tensor

source

pub fn to_scalar(&self) -> TensorResult<&T>

Turn the tensor into a scalar If the tensor has a rank greater than 0, this will return an error

source

pub fn to_vec(&self) -> Vec<T>
where T: Clone,

Turn the tensor into a one-dimensional vector

source

pub fn variable(self) -> Self

Changes the kind of tensor to a variable

source

pub fn with_layout(self, layout: Layout) -> Self

Set the layout of the tensor

source

pub unsafe fn with_layout_unchecked(self, layout: Layout) -> Self

Set the layout of the tensor without checking for compatibility

source

pub fn with_op(self, op: BackpropOp<T>) -> Self

source

pub unsafe fn with_shape_unchecked(self, shape: impl IntoShape) -> Self

source§

impl<T> TensorBase<T>

source

pub fn to_owned(&self) -> TensorBase<T>
where T: Clone,

source

pub fn view<'a>(&'a self) -> TensorBase<&'a T>

source§

impl<T> TensorBase<T>

source

pub fn max(&self) -> &T
where T: Ord,

source

pub fn mean(&self) -> T
where T: Scalar,

source

pub fn min(&self) -> &T
where T: Ord,

source

pub fn sort(&mut self)
where T: Ord,

source

pub fn std(&self) -> T
where T: Scalar,

source

pub fn variance(&self) -> T
where T: Scalar,

source§

impl<T> TensorBase<T>
where T: Scalar,

source

pub fn apply_binary(&self, other: &Self, op: BinaryOp) -> Self

source

pub fn apply_binaryf<F>(&self, other: &Self, op: BinaryOp, f: F) -> Self
where F: Fn(T, T) -> T,

source§

impl<T> TensorBase<T>

source

pub fn pow(&self, exp: T) -> Self
where T: Copy + Pow<T, Output = T>,

source

pub fn powf(&self, exp: T) -> Self
where T: Float,

source

pub fn powi(&self, exp: i32) -> Self
where T: FloatCore,

source§

impl<T> TensorBase<T>
where T: Scalar,

source

pub fn add(&self, other: &Self) -> Self

source

pub fn add_scalar(&self, other: T) -> Self

source§

impl<T> TensorBase<T>
where T: Scalar,

source

pub fn abs(&self) -> TensorBase<<T as Scalar>::Real>
where T: Scalar<Real = T>,

source

pub fn cos(&self) -> Self

source

pub fn cosh(&self) -> Self

source

pub fn exp(&self) -> Self

source

pub fn ln(&self) -> Self

source

pub fn sin(&self) -> Self

source

pub fn sinh(&self) -> Self

source

pub fn sqr(&self) -> Self

source

pub fn sqrt(&self) -> Self

source

pub fn tan(&self) -> Self

source

pub fn tanh(&self) -> Self

source§

impl<T> TensorBase<T>
where T: Clone,

source

pub fn default_like(&self) -> Self
where T: Default,

Create a new tensor, whose elements are set to their default value from the current shape.

source

pub fn empty(shape: impl IntoShape) -> Self
where T: Default,

Create an empty tensor from the given shape

source

pub fn fill(shape: impl IntoShape, value: T) -> Self

Create a tensor, from the given shape, filled with the given value

source

pub fn fill_like(&self, value: T) -> Self

Create a tensor, filled with some value, from the current shape

source§

impl<T> TensorBase<T>
where T: Copy + NumAssign + PartialOrd,

source

pub fn arange(start: T, end: T, step: T) -> Self

Create a tensor within a range of values

source

pub fn eye(size: usize) -> Self

Create an identity matrix of a certain size

source

pub fn linspace(start: T, end: T, steps: usize) -> Self
where T: FromPrimitive,

Create a tensor with a certain number of elements, evenly spaced between the provided start and end values

source

pub fn logspace(start: T, end: T, steps: usize) -> Self
where T: Real,

source

pub fn geomspace(start: T, end: T, steps: usize) -> Self
where T: Real,

source§

impl<T> TensorBase<T>
where T: Clone + One,

source

pub fn ones(shape: impl IntoShape) -> Self

Create a tensor, filled with ones, from the given shape

source

pub fn ones_from(tensor: &TensorBase<T>) -> Self

Create a tensor, filled with ones, from the shape of another tensor

source

pub fn ones_like(&self) -> Self

Create a tensor, filled with ones, from the shape of the tensor

source§

impl<T> TensorBase<T>
where T: Clone + Zero,

source

pub fn zeros(shape: impl IntoShape) -> Self

Create a tensor, filled with zeros, from the given shape

source

pub fn zeros_from(tensor: &TensorBase<T>) -> Self

Create a tensor, filled with zeros, from the shape of another tensor

source

pub fn zeros_like(&self) -> Self

Create a tensor, filled with zeros, from the shape of the tensor

source§

impl<T> TensorBase<T>
where T: Scalar,

source

pub fn grad(&self) -> TensorResult<GradStore<T>>

source§

impl<T> TensorBase<T>
where T: Scalar,

source

pub fn product(&self) -> T

source

pub fn product_axis(&self, _axis: Axis) -> T

source

pub fn sum(&self) -> T

source

pub fn sum_axis(&self, _axis: Axis) -> T

source§

impl<T> TensorBase<T>
where T: Copy,

source

pub fn diag(&self) -> Self

Creates a new tensor containing only the diagonal elements of the original tensor.

source

pub fn inv(&self) -> TensorResult<Self>
where T: NumAssign + PartialOrd,

Find the inverse of the tensor

§Errors

Returns an error if the matrix is not square or if the matrix is singular.

source

pub fn trace(&self) -> TensorResult<T>
where T: Num,

Compute the trace of the matrix. The trace of a matrix is the sum of the diagonal elements.

source§

impl<T> TensorBase<T>
where T: Clone,

source

pub fn broadcast(&self, shape: impl IntoShape) -> Self

coerce the tensor to act like a larger shape. This method doesn’t change the underlying data, but it does change the layout.

source

pub fn pad(&self, shape: impl IntoShape, _with: T) -> Self

source

pub fn swap_axes(&self, swap: Axis, with: Axis) -> Self

Swap two axes in the tensor.

source

pub fn t(&self) -> Self

Transpose the tensor.

source

pub fn reshape(self, shape: impl IntoShape) -> TensorResult<Self>

Reshape the tensor returns an error if the new shape specifies a different number of elements.

Trait Implementations§

source§

impl<'a, 'b, T> Add<&'b TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Add<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the + operator.
source§

fn add(self, other: &'b TensorBase<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<'a, T> Add<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Add<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the + operator.
source§

fn add(self, other: &'a TensorBase<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<'a, T> Add<T> for &'a TensorBase<T>
where T: Copy + Add<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the + operator.
source§

fn add(self, other: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T> Add<T> for TensorBase<T>
where T: Copy + Add<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the + operator.
source§

fn add(self, other: T) -> Self::Output

Performs the + operation. Read more
source§

impl<'a, T> Add<TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Add<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the + operator.
source§

fn add(self, other: TensorBase<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<T> Add for TensorBase<T>
where T: Copy + Add<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self::Output

Performs the + operation. Read more
source§

impl<'a, T> AddAssign<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Add<Output = T>,

source§

fn add_assign(&mut self, other: &'a TensorBase<T>)

Performs the += operation. Read more
source§

impl<T> AddAssign for TensorBase<T>
where T: Copy + Add<T, Output = T>,

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl<'a, T> AsRef<TensorBase<T>> for TensorBase<&'a T>

source§

fn as_ref(&self) -> &TensorBase<T>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: Clone> Clone for TensorBase<T>

source§

fn clone(&self) -> TensorBase<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for TensorBase<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, 'b, T> Div<&'b TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Div<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the / operator.
source§

fn div(self, other: &'b TensorBase<T>) -> Self::Output

Performs the / operation. Read more
source§

impl<'a, T> Div<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Div<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the / operator.
source§

fn div(self, other: &'a TensorBase<T>) -> Self::Output

Performs the / operation. Read more
source§

impl<'a, T> Div<T> for &'a TensorBase<T>
where T: Copy + Div<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the / operator.
source§

fn div(self, other: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T> Div<T> for TensorBase<T>
where T: Copy + Div<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the / operator.
source§

fn div(self, other: T) -> Self::Output

Performs the / operation. Read more
source§

impl<'a, T> Div<TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Div<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the / operator.
source§

fn div(self, other: TensorBase<T>) -> Self::Output

Performs the / operation. Read more
source§

impl<T> Div for TensorBase<T>
where T: Copy + Div<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<'a, T> DivAssign<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Div<Output = T>,

source§

fn div_assign(&mut self, other: &'a TensorBase<T>)

Performs the /= operation. Read more
source§

impl<T> DivAssign for TensorBase<T>
where T: Copy + Div<T, Output = T>,

source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
source§

impl<'a, T> From<&'a TensorBase<T>> for Iter<'a, T>

source§

fn from(tensor: &'a TensorBase<T>) -> Self

Converts to this type from the input type.
source§

impl<T> From<TensorBase<T>> for Tensors<T>
where T: Clone,

source§

fn from(tensor: TensorBase<T>) -> Self

Converts to this type from the input type.
source§

impl<T> FromIterator<T> for TensorBase<T>

source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl<T: Hash> Hash for TensorBase<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<Idx, T> Index<Idx> for TensorBase<T>
where Idx: AsRef<[usize]>,

§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: Idx) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<Idx, T> IndexMut<Idx> for TensorBase<T>
where Idx: AsRef<[usize]>,

source§

fn index_mut(&mut self, index: Idx) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<T> Inverse for TensorBase<T>
where T: Copy + Num + NumAssign + PartialOrd,

§

type Output = Result<TensorBase<T>, TensorError>

source§

fn inv(&self) -> Self::Output

source§

impl<T> Matmul for TensorBase<T>
where T: Scalar,

§

type Output = TensorBase<T>

source§

fn matmul(&self, other: &Self) -> Self

source§

impl<'a, 'b, T> Mul<&'b TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Mul<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: &'b TensorBase<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, T> Mul<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Mul<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: &'a TensorBase<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, T> Mul<T> for &'a TensorBase<T>
where T: Copy + Mul<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T> Mul<T> for TensorBase<T>
where T: Copy + Mul<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, T> Mul<TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Mul<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: TensorBase<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T> Mul for TensorBase<T>
where T: Copy + Mul<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, T> MulAssign<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Mul<Output = T>,

source§

fn mul_assign(&mut self, other: &'a TensorBase<T>)

Performs the *= operation. Read more
source§

impl<T> MulAssign for TensorBase<T>
where T: Copy + Mul<T, Output = T>,

source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
source§

impl<'a, T> Neg for &'a TensorBase<T>
where T: Copy + Neg<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<T> Neg for TensorBase<T>
where T: Copy + Neg<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<'a, T> Not for &'a TensorBase<T>
where T: Copy + Not<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<T> Not for TensorBase<T>
where T: Copy + Not<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<T> Num for TensorBase<T>
where T: Scalar + Num,

§

type FromStrRadixErr = <T as Num>::FromStrRadixErr

source§

fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
source§

impl<T> One for TensorBase<T>
where T: Copy + One,

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

impl<T> Ord for TensorBase<T>
where T: Ord,

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<S, T> PartialEq<S> for TensorBase<T>
where S: AsRef<[T]>, T: PartialEq,

source§

fn eq(&self, other: &S) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PartialEq for TensorBase<T>
where T: PartialEq,

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PartialOrd for TensorBase<T>
where T: PartialOrd,

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, T> Pow<T> for &'a TensorBase<T>
where T: Copy + Pow<T, Output = T>,

§

type Output = TensorBase<T>

The result after applying the operator.
source§

fn pow(self, exp: T) -> Self::Output

Returns self to the power rhs. Read more
source§

impl<T> Pow<T> for TensorBase<T>
where T: Copy + Pow<T, Output = T>,

§

type Output = TensorBase<T>

The result after applying the operator.
source§

fn pow(self, exp: T) -> Self::Output

Returns self to the power rhs. Read more
source§

impl<'a, 'b, T> Rem<&'b TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Rem<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: &'b TensorBase<T>) -> Self::Output

Performs the % operation. Read more
source§

impl<'a, T> Rem<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Rem<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: &'a TensorBase<T>) -> Self::Output

Performs the % operation. Read more
source§

impl<'a, T> Rem<T> for &'a TensorBase<T>
where T: Copy + Rem<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: T) -> Self::Output

Performs the % operation. Read more
source§

impl<T> Rem<T> for TensorBase<T>
where T: Copy + Rem<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: T) -> Self::Output

Performs the % operation. Read more
source§

impl<'a, T> Rem<TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Rem<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: TensorBase<T>) -> Self::Output

Performs the % operation. Read more
source§

impl<T> Rem for TensorBase<T>
where T: Copy + Rem<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: Self) -> Self::Output

Performs the % operation. Read more
source§

impl<'a, T> RemAssign<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Rem<Output = T>,

source§

fn rem_assign(&mut self, other: &'a TensorBase<T>)

Performs the %= operation. Read more
source§

impl<T> RemAssign for TensorBase<T>
where T: Copy + Rem<T, Output = T>,

source§

fn rem_assign(&mut self, other: Self)

Performs the %= operation. Read more
source§

impl<T> Statistics<T> for TensorBase<T>
where T: Ord + Scalar,

source§

fn max(&self) -> T

Returns the maximum value in the collection.
source§

fn mean(&self) -> T

Returns the mean (average) value of the collection.
source§

fn median(&self) -> T

Returns the median value in the collection.
source§

fn min(&self) -> T

Returns the minimum value in the collection.
source§

fn mode(&self) -> T

Get the mode of the collection.
source§

fn sum(&self) -> T

source§

fn std(&self) -> T

Compute the standard deviation
source§

fn variance(&self) -> T

Compute the variance
source§

impl<T> Store<TensorId, TensorBase<T>> for GradStore<T>

source§

fn get(&self, key: &TensorId) -> Option<&TensorBase<T>>

source§

fn get_mut(&mut self, key: &TensorId) -> Option<&mut TensorBase<T>>

source§

fn insert( &mut self, key: TensorId, value: TensorBase<T> ) -> Option<TensorBase<T>>

source§

fn remove(&mut self, key: &TensorId) -> Option<TensorBase<T>>

source§

impl<'a, 'b, T> Sub<&'b TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Sub<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: &'b TensorBase<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<'a, T> Sub<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Sub<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: &'a TensorBase<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<'a, T> Sub<T> for &'a TensorBase<T>
where T: Copy + Sub<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T> Sub<T> for TensorBase<T>
where T: Copy + Sub<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: T) -> Self::Output

Performs the - operation. Read more
source§

impl<'a, T> Sub<TensorBase<T>> for &'a TensorBase<T>
where T: Copy + Sub<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: TensorBase<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T> Sub for TensorBase<T>
where T: Copy + Sub<Output = T>,

§

type Output = TensorBase<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<'a, T> SubAssign<&'a TensorBase<T>> for TensorBase<T>
where T: Copy + Sub<Output = T>,

source§

fn sub_assign(&mut self, other: &'a TensorBase<T>)

Performs the -= operation. Read more
source§

impl<T> SubAssign for TensorBase<T>
where T: Copy + Sub<T, Output = T>,

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl<T> Zero for TensorBase<T>
where T: Copy + Zero,

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl<T> Eq for TensorBase<T>
where T: Eq,

Auto Trait Implementations§

§

impl<T> Freeze for TensorBase<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for TensorBase<T>
where T: RefUnwindSafe,

§

impl<T> Send for TensorBase<T>
where T: Send,

§

impl<T> Sync for TensorBase<T>
where T: Sync,

§

impl<T> Unpin for TensorBase<T>
where T: Unpin,

§

impl<T> UnwindSafe for TensorBase<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<S, A, B, C> Affine<A, B> for S
where S: Clone + Mul<A, Output = C>, C: Add<B, Output = C>,

§

type Output = C

source§

fn affine(&self, mul: A, add: B) -> <S as Affine<A, B>>::Output

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

source§

impl<T> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,