pub struct Df64QrVjp {
pub has_q: bool,
pub has_r: bool,
}Expand description
Reverse-mode adjoint of the reduced QR factorization.
The adjoint is a numerical body of its own: it needs a triangular solve against the primal factor, so it is an operation rather than a graph of preset operations, which a scalar tenferro does not declare could not execute anyway.
§Examples
use tenferro_df64_proof::extension::Df64QrVjp;
use tenferro_ad::extension::ExtensionOp;
// A loss that depends on the triangular factor alone supplies one cotangent.
let adjoint = Df64QrVjp::of(false, true);
assert_eq!(<Df64QrVjp as ExtensionOp>::input_count(&adjoint), 3);
assert_eq!(<Df64QrVjp as ExtensionOp>::output_count(&adjoint), 1);
assert_eq!(
<Df64QrVjp as ExtensionOp>::input_count(&Df64QrVjp::of(true, true)),
4
);Fields§
§has_q: boolWhether the caller supplied the factor’s cotangent.
has_r: boolWhether the caller supplied the triangular factor’s cotangent.
Implementations§
Source§impl Df64QrVjp
impl Df64QrVjp
Sourcepub const fn of(has_q: bool, has_r: bool) -> Self
pub const fn of(has_q: bool, has_r: bool) -> Self
Construct the adjoint for one cotangent availability.
§Examples
use tenferro_df64_proof::extension::Df64QrVjp;
// Only the triangular factor carries a cotangent here.
let adjoint = Df64QrVjp::of(false, true);
assert!(!adjoint.has_q);
assert!(adjoint.has_r);Trait Implementations§
impl Copy for Df64QrVjp
Source§impl ExtensionOp for Df64QrVjp
impl ExtensionOp for Df64QrVjp
Source§fn payload_hash(&self, hasher: &mut dyn Hasher)
fn payload_hash(&self, hasher: &mut dyn Hasher)
Hash the payload (everything except
family_id). Read moreSource§fn payload_eq(&self, other: &dyn ExtensionOp) -> bool
fn payload_eq(&self, other: &dyn ExtensionOp) -> bool
Structural equality against another extension value. Read more
Source§fn input_count(&self) -> usize
fn input_count(&self) -> usize
Number of primal inputs. MUST be constant for any given
Arc<dyn ExtensionOp> value.Source§fn output_count(&self) -> usize
fn output_count(&self) -> usize
Number of outputs. MUST match the length of the vector returned by a
successful
Self::infer_output_meta call.Source§fn semantic_effects(&self) -> ExtensionEffectDeclaration<'_>
fn semantic_effects(&self) -> ExtensionEffectDeclaration<'_>
Declare observable semantic effects for this extension payload. Read more
Source§fn semantic_aliases(&self) -> ExtensionAliasDeclaration<'_>
fn semantic_aliases(&self) -> ExtensionAliasDeclaration<'_>
Declare semantic output aliasing for this extension payload. Read more
Source§fn scalar_identity(&self) -> Option<&'static str>
fn scalar_identity(&self) -> Option<&'static str>
Canonical identity of an externally defined scalar this operation carries. Read more
Source§fn infer_output_meta(
&self,
ctx: &mut ExtensionShapeContext<'_>,
) -> Result<Vec<(DType, Vec<SymDim>)>>
fn infer_output_meta( &self, ctx: &mut ExtensionShapeContext<'_>, ) -> Result<Vec<(DType, Vec<SymDim>)>>
Infer output dtypes and shapes for each output slot. Read more
Source§fn lower_to_standard_ops(
&self,
_builder: &mut GraphBuilder<StdTensorOp>,
_inputs: &[ValueRef<StdTensorOp>],
_input_dtypes: &[DType],
_input_shapes: &[&[SymDim]],
) -> Result<ExtensionStandardLowering, ExtensionLoweringError>
fn lower_to_standard_ops( &self, _builder: &mut GraphBuilder<StdTensorOp>, _inputs: &[ValueRef<StdTensorOp>], _input_dtypes: &[DType], _input_shapes: &[&[SymDim]], ) -> Result<ExtensionStandardLowering, ExtensionLoweringError>
Try to expand this extension into standard tensor graph operations. Read more
Source§fn prune_outputs(&self, _live_outputs: &[bool]) -> Option<Arc<dyn ExtensionOp>>
fn prune_outputs(&self, _live_outputs: &[bool]) -> Option<Arc<dyn ExtensionOp>>
Optionally return an equivalent op that produces only live outputs. Read more
Auto Trait Implementations§
impl Freeze for Df64QrVjp
impl RefUnwindSafe for Df64QrVjp
impl Send for Df64QrVjp
impl Sync for Df64QrVjp
impl Unpin for Df64QrVjp
impl UnsafeUnpin for Df64QrVjp
impl UnwindSafe for Df64QrVjp
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,
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