pub struct LinearFragment<Op: GraphOp> {
pub fragment: Fragment<Op>,
pub tangent_inputs: Vec<(Op::InputKey, LocalValId)>,
pub tangent_outputs: Vec<Option<LocalValId>>,
}Expand description
A linear fragment produced by crate::differentiate or crate::transpose.
§Examples
ⓘ
use computegraph::resolve::resolve;
use tidu::differentiate;
let view = resolve(vec![primal_fragment]);
let mut ctx = ();
let linear = differentiate(&view, &[output_key], &[input_key], 1, &mut ctx);
assert_eq!(linear.tangent_inputs.len(), 1);Fields§
§fragment: Fragment<Op>The fragment containing linear ops.
tangent_inputs: Vec<(Op::InputKey, LocalValId)>(primal_input_key, tangent_local_val_id) pairs.
tangent_outputs: Vec<Option<LocalValId>>Tangent outputs, aligned with the requested outputs of the source transform.
None means the corresponding output is inactive.
Auto Trait Implementations§
impl<Op> Freeze for LinearFragment<Op>
impl<Op> RefUnwindSafe for LinearFragment<Op>where
<Op as GraphOp>::InputKey: RefUnwindSafe,
Op: RefUnwindSafe,
impl<Op> Send for LinearFragment<Op>
impl<Op> Sync for LinearFragment<Op>
impl<Op> Unpin for LinearFragment<Op>
impl<Op> UnsafeUnpin for LinearFragment<Op>
impl<Op> UnwindSafe for LinearFragment<Op>
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