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.
Sourcepub fn required_values(&self) -> Vec<bool>
pub fn required_values(&self) -> Vec<bool>
Returns a mask of values needed to evaluate the derivative outputs.
Trait Implementations§
Source§impl Clone for GradientKernelIr
impl Clone for GradientKernelIr
Source§fn clone(&self) -> GradientKernelIr
fn clone(&self) -> GradientKernelIr
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more