pub struct GradientKernelIr { /* private fields */ }Expand description
Validated IR containing a primal computation and real gradient outputs.
Implementations§
Source§impl GradientKernelIr
impl GradientKernelIr
Sourcepub fn new(
values: Vec<KernelValue>,
primal_root: KernelValueId,
outputs: Vec<KernelValueId>,
component: OutputComponent,
) -> Result<Self, KernelIrError>
pub fn new( values: Vec<KernelValue>, primal_root: KernelValueId, outputs: Vec<KernelValueId>, component: OutputComponent, ) -> Result<Self, KernelIrError>
Validates and constructs a gradient kernel.
§Errors
Returns KernelIrError when the primal IR is invalid, the primal
root is not scalar, a gradient output is out of bounds, or a gradient
output is not real-valued.
Sourcepub fn validate(&self) -> Result<(), KernelIrError>
pub fn validate(&self) -> Result<(), KernelIrError>
Revalidates the primal root and real gradient outputs.
§Errors
Returns KernelIrError when the primal IR is invalid, the primal
root is not scalar, a gradient output is out of bounds, or a gradient
output is not real-valued.
Sourcepub fn values(&self) -> &[KernelValue]
pub fn values(&self) -> &[KernelValue]
Returns all primal and derivative IR values in topological order.
Sourcepub fn primal_root(&self) -> KernelValueId
pub fn primal_root(&self) -> KernelValueId
Returns the primal scalar output identifier.
Sourcepub fn outputs(&self) -> &[KernelValueId]
pub fn outputs(&self) -> &[KernelValueId]
Returns derivative output identifiers.
Sourcepub fn component(&self) -> OutputComponent
pub fn component(&self) -> OutputComponent
Returns the differentiated component of the complex primal.
Trait Implementations§
Source§impl Clone for GradientKernelIr
impl Clone for GradientKernelIr
Source§fn clone(&self) -> GradientKernelIr
fn clone(&self) -> GradientKernelIr
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GradientKernelIr
impl RefUnwindSafe for GradientKernelIr
impl Send for GradientKernelIr
impl Sync for GradientKernelIr
impl Unpin for GradientKernelIr
impl UnsafeUnpin for GradientKernelIr
impl UnwindSafe for GradientKernelIr
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