pub struct CustomFunction { /* private fields */ }Expand description
A function with custom transform rules; see custom_function.
Implementations§
Source§impl CustomFunction
impl CustomFunction
Sourcepub fn with_vjp(
self,
rule: impl Fn(&[Array], &[Array], &[Array]) -> Result<Vec<Array>> + Send + Sync + 'static,
) -> Self
pub fn with_vjp( self, rule: impl Fn(&[Array], &[Array], &[Array]) -> Result<Vec<Array>> + Send + Sync + 'static, ) -> Self
Sets the reverse-mode rule: (primals, outputs, cotangents) → one cotangent per
primal.
Sourcepub fn with_jvp(
self,
rule: impl Fn(&[Array], &[Array]) -> Result<Vec<Array>> + Send + Sync + 'static,
) -> Self
pub fn with_jvp( self, rule: impl Fn(&[Array], &[Array]) -> Result<Vec<Array>> + Send + Sync + 'static, ) -> Self
Sets the forward-mode rule: (primals, tangents) → one tangent per output (missing
input tangents are passed as zeros).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CustomFunction
impl !UnwindSafe for CustomFunction
impl Freeze for CustomFunction
impl Send for CustomFunction
impl Sync for CustomFunction
impl Unpin for CustomFunction
impl UnsafeUnpin for CustomFunction
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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