pub struct AddOne<N>(pub N);
Expand description
Operator that applies f[g](x) = g(x) + 1
element-wise to a buffer.
§Examples
let f = AddOne(X.into_var());
assert_eq!(f.evaluate_dual(X, ctx!{X = 1.0}).unwrap(), dual!(2.0, 1.0));
assert_eq!(f.evaluate_dual(X, ctx!{X = 0.0}).unwrap(), dual!(1.0, 1.0));
assert_eq!(f.evaluate_dual(X, ctx!{X = -1.0}).unwrap(), dual!(0.0, 1.0));
Tuple Fields§
§0: N
Trait Implementations§
Source§impl<T, N> Differentiable<T> for AddOne<N>where
T: Identifier,
N: Differentiable<T>,
impl<T, N> Differentiable<T> for AddOne<N>where
T: Identifier,
N: Differentiable<T>,
Source§type Adjoint = <N as Differentiable<T>>::Adjoint
type Adjoint = <N as Differentiable<T>>::Adjoint
The adjoint operator; i.e. the gradient.
Source§fn evaluate_adjoint<C: Context, CR: AsRef<C>>(
&self,
target: T,
ctx: CR,
) -> AegirResult<Self::Adjoint, C>
fn evaluate_adjoint<C: Context, CR: AsRef<C>>( &self, target: T, ctx: CR, ) -> AegirResult<Self::Adjoint, C>
Helper method that computes the adjoint and evaluates its value. Read more
Source§impl<C, N, F> Function<C> for AddOne<N>
impl<C, N, F> Function<C> for AddOne<N>
Source§impl<N: Node> Node for AddOne<N>
impl<N: Node> Node for AddOne<N>
fn add<N: Node>(self, other: N) -> Add<Self, N>where
Self: Sized,
fn sub<N: Node>(self, other: N) -> Sub<Self, N>where
Self: Sized,
fn mul<N: Node>(self, other: N) -> Mul<Self, N>where
Self: Sized,
fn div<N: Node>(self, other: N) -> Div<Self, N>where
Self: Sized,
fn dot<N: Node>(self, other: N) -> TensorDot<Self, N>where
Self: Sized,
fn abs(self) -> Abs<Self>where
Self: Sized,
fn neg(self) -> Negate<Self>where
Self: Sized,
fn pow<P>(self, power: P) -> Power<Self, P>where
Self: Sized,
fn ln(self) -> Ln<Self>where
Self: Sized,
fn squared(self) -> Square<Self>where
Self: Sized,
fn sum(self) -> Sum<Self>where
Self: Sized,
fn sigmoid(self) -> Sigmoid<Self>where
Self: Sized,
impl<N: Copy> Copy for AddOne<N>
impl<N> StructuralPartialEq for AddOne<N>
Auto Trait Implementations§
impl<N> Freeze for AddOne<N>where
N: Freeze,
impl<N> RefUnwindSafe for AddOne<N>where
N: RefUnwindSafe,
impl<N> Send for AddOne<N>where
N: Send,
impl<N> Sync for AddOne<N>where
N: Sync,
impl<N> Unpin for AddOne<N>where
N: Unpin,
impl<N> UnwindSafe for AddOne<N>where
N: UnwindSafe,
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 more