Skip to main content

ExtensionLinearTransposeRule

Trait ExtensionLinearTransposeRule 

Source
pub trait ExtensionLinearTransposeRule:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn family_id(&self) -> &'static str;
    fn linear_transpose(
        &self,
        op: &(dyn ExtensionOp + 'static),
        builder: &mut dyn PrimitiveRuleBuilder,
        cotangent_out: &[Option<usize>],
        inputs: &[PrimitiveTransposeInput<StdTensorOp>],
        active_mask: &[bool],
        ctx: &mut ShapeGuardContext,
    ) -> Result<Vec<Option<usize>>, ADRuleError>;
}
Expand description

Adjoint rule for an extension op viewed as a linear map in active inputs.

This rule is used only while linear_transpose walks a linearized graph.

Required Methods§

Source

fn family_id(&self) -> &'static str

The extension family this rule handles.

Source

fn linear_transpose( &self, op: &(dyn ExtensionOp + 'static), builder: &mut dyn PrimitiveRuleBuilder, cotangent_out: &[Option<usize>], inputs: &[PrimitiveTransposeInput<StdTensorOp>], active_mask: &[bool], ctx: &mut ShapeGuardContext, ) -> Result<Vec<Option<usize>>, ADRuleError>

Emit cotangents for active linear inputs.

Implementors§