pub struct ReverseVariable {
pub index: usize,
pub value: f64,
pub grad: f64,
}
Expand description
Variable in the computational graph for reverse-mode AD
Fields§
§index: usize
Variable index in the tape
value: f64
Current value
grad: f64
Accumulated gradient (adjoint)
Implementations§
Source§impl ReverseVariable
impl ReverseVariable
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Check if this is a constant
Sourcepub fn from_scalar(value: f64) -> Self
pub fn from_scalar(value: f64) -> Self
Create a variable from a scalar (convenience method)
Trait Implementations§
Source§impl Add<ReverseVariable> for f64
impl Add<ReverseVariable> for f64
Source§type Output = ReverseVariable
type Output = ReverseVariable
The resulting type after applying the
+
operator.Source§fn add(self, var: ReverseVariable) -> ReverseVariable
fn add(self, var: ReverseVariable) -> ReverseVariable
Performs the
+
operation. Read moreSource§impl Add<f64> for ReverseVariable
impl Add<f64> for ReverseVariable
Source§impl Add for ReverseVariable
impl Add for ReverseVariable
Source§impl Clone for ReverseVariable
impl Clone for ReverseVariable
Source§fn clone(&self) -> ReverseVariable
fn clone(&self) -> ReverseVariable
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ReverseVariable
impl Debug for ReverseVariable
Source§impl Div<ReverseVariable> for f64
impl Div<ReverseVariable> for f64
Source§type Output = ReverseVariable
type Output = ReverseVariable
The resulting type after applying the
/
operator.Source§fn div(self, var: ReverseVariable) -> ReverseVariable
fn div(self, var: ReverseVariable) -> ReverseVariable
Performs the
/
operation. Read moreSource§impl Div<f64> for ReverseVariable
impl Div<f64> for ReverseVariable
Source§impl Div for ReverseVariable
impl Div for ReverseVariable
Source§impl Mul<ReverseVariable> for f64
impl Mul<ReverseVariable> for f64
Source§type Output = ReverseVariable
type Output = ReverseVariable
The resulting type after applying the
*
operator.Source§fn mul(self, var: ReverseVariable) -> ReverseVariable
fn mul(self, var: ReverseVariable) -> ReverseVariable
Performs the
*
operation. Read moreSource§impl Mul<f64> for ReverseVariable
impl Mul<f64> for ReverseVariable
Source§impl Mul for ReverseVariable
impl Mul for ReverseVariable
Source§impl Neg for ReverseVariable
impl Neg for ReverseVariable
Source§impl Sub<ReverseVariable> for f64
impl Sub<ReverseVariable> for f64
Source§type Output = ReverseVariable
type Output = ReverseVariable
The resulting type after applying the
-
operator.Source§fn sub(self, var: ReverseVariable) -> ReverseVariable
fn sub(self, var: ReverseVariable) -> ReverseVariable
Performs the
-
operation. Read moreSource§impl Sub<f64> for ReverseVariable
impl Sub<f64> for ReverseVariable
Auto Trait Implementations§
impl Freeze for ReverseVariable
impl RefUnwindSafe for ReverseVariable
impl Send for ReverseVariable
impl Sync for ReverseVariable
impl Unpin for ReverseVariable
impl UnwindSafe for ReverseVariable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.