pub struct Df64VjpRule;Expand description
Reverse-mode rule for the contribution’s operations.
The total sum’s adjoint is a broadcast, and the conversions are linear, so their adjoint swaps the two directions. None of them reads the primal value, so the rule declares no residual.
§Examples
use tenferro_ad::semantic_extension::{SemanticExtensionRuleSet, SemanticPrimalVjpRule};
use tenferro_df64_proof::ad::Df64VjpRule;
let rule = Df64VjpRule;
assert_eq!(
<Df64VjpRule as SemanticPrimalVjpRule>::family_id(&rule),
"tenferro-df64-proof.df64_ops.v1"
);
// The rule set a downstream application installs.
let rules = SemanticExtensionRuleSet::new()
.with_primal_vjp(std::sync::Arc::new(rule))
.expect("one rule per family");
assert!(rules.lookup_primal_vjp("tenferro-df64-proof.df64_ops.v1").is_some());Trait Implementations§
Source§impl Debug for Df64VjpRule
impl Debug for Df64VjpRule
Source§impl SemanticPrimalVjpRule for Df64VjpRule
impl SemanticPrimalVjpRule for Df64VjpRule
Source§fn family_id(&self) -> &'static str
fn family_id(&self) -> &'static str
Return the versioned extension family handled by this rule.
Source§fn residual_mask(&self) -> ResidualSpec
fn residual_mask(&self) -> ResidualSpec
Declare which primal input/output indices this rule reads as tensor
residuals. Indices not declared may only be accessed through metadata.
Source§fn primal_vjp(
&self,
request: SemanticPrimalVjpRequest<'_>,
builder: &mut SemanticProgramBuilder,
) -> Result<Box<[AdValue]>, SemanticAdError>
fn primal_vjp( &self, request: SemanticPrimalVjpRequest<'_>, builder: &mut SemanticProgramBuilder, ) -> Result<Box<[AdValue]>, SemanticAdError>
Emit ordered optional input cotangents into
builder. Read moreAuto Trait Implementations§
impl Freeze for Df64VjpRule
impl RefUnwindSafe for Df64VjpRule
impl Send for Df64VjpRule
impl Sync for Df64VjpRule
impl Unpin for Df64VjpRule
impl UnsafeUnpin for Df64VjpRule
impl UnwindSafe for Df64VjpRule
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
impl<T, U> Imply<T> for U
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