Struct TensorBase

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

Implementations§

Source§

impl<T> TensorBase<T>

Source

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

Create a new tensor from an iterator.

Source

pub unsafe fn from_raw_parts( ptr: *mut T, shape: impl IntoShape, stride: impl IntoStride, ) -> TensorBase<T>

Source

pub fn from_scalar(value: T) -> TensorBase<T>

Create a new tensor from a scalar value.

Source

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

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

Source

pub unsafe fn from_shape_ptr( shape: impl IntoShape, ptr: *mut T, ) -> TensorBase<T>

Source

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

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

Source

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

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: &TensorBase<T>)
where T: Clone,

Assign the values of another tensor to this tensor.

Source

pub fn boxed(self) -> Box<TensorBase<T>>

Source

pub fn detach(&self) -> TensorBase<T>
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 unsafe fn into_scalar(self) -> T
where T: Clone,

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>

Creates an immutable iterator over the elements in the tensor.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Create a mutable iterator over the elements in 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) -> Result<&T, TensorError>

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) -> TensorBase<T>

Changes the kind of tensor to a variable

Source

pub fn with_layout(self, layout: Layout) -> TensorBase<T>

Set the layout of the tensor

Source

pub unsafe fn with_layout_unchecked(self, layout: Layout) -> TensorBase<T>

Set the layout of the tensor without checking for compatibility

§Safety

This function is unsafe because it does not check if the layout is compatible with the tensor.

Source

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

Source

pub fn with_shape_c(self, shape: impl IntoShape) -> TensorBase<T>

Source§

impl<T> TensorBase<T>

Source

pub fn view_from_scalar(scalar: &T) -> TensorBase<&T>

Source

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

Source

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

Source

pub fn view_mut(&mut self) -> TensorBase<&mut 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: &TensorBase<T>, op: BinaryOp) -> TensorBase<T>

Source

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

Source§

impl<T> TensorBase<T>

Source

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

Source

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

Source

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

Source§

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

Source

pub fn add(&self, other: &TensorBase<T>) -> TensorBase<T>

Source

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

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 sigmoid(&self) -> TensorBase<T>
where T: ScalarExt,

Source

pub fn cos(&self) -> TensorBase<T>

Source

pub fn cosh(&self) -> TensorBase<T>

Source

pub fn exp(&self) -> TensorBase<T>

Source

pub fn ln(&self) -> TensorBase<T>

Source

pub fn recip(&self) -> TensorBase<T>

Source

pub fn sin(&self) -> TensorBase<T>

Source

pub fn sinh(&self) -> TensorBase<T>

Source

pub fn sqr(&self) -> TensorBase<T>

Source

pub fn sqrt(&self) -> TensorBase<T>

Source

pub fn tan(&self) -> TensorBase<T>

Source

pub fn tanh(&self) -> TensorBase<T>

Source§

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

Source

pub fn default_like(&self) -> TensorBase<T>
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) -> TensorBase<T>
where T: Default,

Create an empty tensor from the given shape

Source

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

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

Source

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

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

Source

pub fn like_with(&self, data: Vec<T>) -> TensorBase<T>

Source§

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

Source

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

Create a tensor within a range of values

Source

pub fn eye(size: usize) -> TensorBase<T>

Create an identity matrix of a certain size

Source

pub fn linspace(start: T, end: T, steps: usize) -> TensorBase<T>
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) -> TensorBase<T>
where T: Real,

Source

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

Source§

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

Source

pub fn ones(shape: impl IntoShape) -> TensorBase<T>

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

Source

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

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

Source

pub fn ones_like(&self) -> TensorBase<T>

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) -> TensorBase<T>

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

Source

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

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

Source

pub fn zeros_like(&self) -> TensorBase<T>

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

Source§

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

Source

pub fn grad(&self) -> Result<TensorGrad<T>, TensorError>

Compute the gradient of the tensor

Source§

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

Source

pub fn product(&self) -> T
where T: Product,

Compute the product of all elements in the tensor

Source

pub fn sum(&self) -> T
where T: Sum,

Compute the sum of all elements in the tensor

Source§

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

Source

pub fn diag(&self) -> TensorBase<T>

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

Source

pub fn inv(&self) -> Result<TensorBase<T>, TensorError>
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) -> Result<T, TensorError>
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) -> TensorBase<T>

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 swap_axes(&self, swap: Axis, with: Axis) -> TensorBase<T>

Swap two axes in the tensor.

Source

pub fn t(&self) -> TensorBase<T>

Transpose the tensor.

Source

pub fn reshape( self, shape: impl IntoShape, ) -> Result<TensorBase<T>, TensorError>

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>,

Source§

type Output = TensorBase<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: TensorBase<T>) -> <TensorBase<T> as Add>::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<Output = T>,

Source§

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

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 for TensorBase<T>
where T: Clone,

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 for TensorBase<T>
where T: Debug,

Source§

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

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

impl<'de, T> Deserialize<'de> for TensorBase<T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TensorBase<T>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: TensorBase<T>) -> <TensorBase<T> as Div>::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<Output = T>,

Source§

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

Performs the /= operation. Read more
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

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>) -> Tensors<T>

Converts to this type from the input type.
Source§

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

Source§

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

Creates a value from an iterator. Read more
Source§

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

Source§

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

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]>,

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: Idx) -> &<TensorBase<T> as Index<Idx>>::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 <TensorBase<T> as Index<Idx>>::Output

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

impl<T> IntoIterator for TensorBase<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <TensorBase<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

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

Source§

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

Source§

type Output = TensorBase<T>

Source§

fn matmul(&self, other: &TensorBase<T>) -> TensorBase<T>

Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: TensorBase<T>) -> <TensorBase<T> as Mul>::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<Output = T>,

Source§

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

Performs the *= operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> <&'a TensorBase<T> as Neg>::Output

Performs the unary - operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> <TensorBase<T> as Neg>::Output

Performs the unary - operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the ! operator.
Source§

fn not(self) -> <&'a TensorBase<T> as Not>::Output

Performs the unary ! operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the ! operator.
Source§

fn not(self) -> <TensorBase<T> as Not>::Output

Performs the unary ! operation. Read more
Source§

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

Source§

type FromStrRadixErr = <T as Num>::FromStrRadixErr

Source§

fn from_str_radix( str: &str, radix: u32, ) -> Result<TensorBase<T>, <TensorBase<T> as Num>::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() -> TensorBase<T>

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§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

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

Source§

fn cmp(&self, other: &TensorBase<T>) -> 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,

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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: &TensorBase<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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: &TensorBase<T>) -> 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

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

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

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

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>,

Source§

type Output = TensorBase<T>

The result after applying the operator.
Source§

fn pow(self, exp: T) -> <&'a TensorBase<T> as Pow<T>>::Output

Returns self to the power rhs. Read more
Source§

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

Source§

type Output = TensorBase<T>

The result after applying the operator.
Source§

fn pow(self, exp: T) -> <TensorBase<T> as Pow<T>>::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>,

Source§

type Output = TensorBase<T>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the % operator.
Source§

fn rem(self, other: TensorBase<T>) -> <TensorBase<T> as Rem>::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<Output = T>,

Source§

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

Performs the %= operation. Read more
Source§

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

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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 TensorGrad<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>,

Source§

type Output = TensorBase<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = TensorBase<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: TensorBase<T>) -> <TensorBase<T> as Sub>::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<Output = T>,

Source§

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

Performs the -= operation. Read more
Source§

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

Source§

fn zero() -> TensorBase<T>

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>,

Source§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<I, M, T> ForwardIter<T> for I
where I: IntoIterator<Item = M>, M: Forward<T, Output = T>, T: Clone,

Source§

type Item = M

Source§

fn forward_iter( self, args: &T, ) -> Result<<M as Forward<T>>::Output, PredictError>

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<S, F> IntoOp<F> for S
where F: Operator, S: Into<F>,

Source§

fn into_op(self) -> F

Source§

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

Source§

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>,

Source§

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>,

Source§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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>,