pub struct Ln<N>(pub N);
Expand description
Operator that applies f[g](x) = ln(g(x))
element-wise to a buffer.
Examples
let op = Ln(X.into_var());
assert!((op.evaluate(ctx!{X = 2.0f64.exp()}).unwrap() - 2.0).abs() < 1e-5);
assert!((op.evaluate(ctx!{X = 4.0f64.exp()}).unwrap() - 4.0).abs() < 1e-5);
Tuple Fields§
§0: N
Trait Implementations§
source§impl<T, N> Differentiable<T> for Ln<N>where
T: Identifier,
N: Differentiable<T> + Clone,
impl<T, N> Differentiable<T> for Ln<N>where
T: Identifier,
N: Differentiable<T> + Clone,
§type Adjoint = Div<<N as Differentiable<T>>::Adjoint, N>
type Adjoint = Div<<N as Differentiable<T>>::Adjoint, N>
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>where
Self: Function<C>,
Self::Adjoint: Function<C>,
fn evaluate_adjoint<C: Context, CR: AsRef<C>>(
&self,
target: T,
ctx: CR
) -> AegirResult<Self::Adjoint, C>where
Self: Function<C>,
Self::Adjoint: Function<C>,
Helper method that computes the adjoint and evaluates its value. Read more
source§fn evaluate_dual<C: Context, CR: AsRef<C>>(
&self,
target: T,
ctx: CR
) -> Result<DualOf<Self, C, T>, BinaryError<Self::Error, <AdjointOf<Self, T> as Function<C>>::Error, NoError>>where
Self: Function<C>,
Self::Adjoint: Function<C>,
fn evaluate_dual<C: Context, CR: AsRef<C>>(
&self,
target: T,
ctx: CR
) -> Result<DualOf<Self, C, T>, BinaryError<Self::Error, <AdjointOf<Self, T> as Function<C>>::Error, NoError>>where
Self: Function<C>,
Self::Adjoint: Function<C>,
Helper method that evaluates the function and its adjoint, wrapping up
in a Dual.