pub trait SemanticPrimalVjpRule:
Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn family_id(&self) -> &'static str;
fn residual_mask(&self) -> ResidualSpec;
fn primal_vjp(
&self,
request: SemanticPrimalVjpRequest<'_>,
builder: &mut SemanticProgramBuilder,
) -> Result<Box<[AdValue]>, SemanticAdError>;
}Expand description
Optional direct VJP rule expressed against primal semantic values.
Required Methods§
Sourcefn family_id(&self) -> &'static str
fn family_id(&self) -> &'static str
Return the versioned extension family handled by this rule.
Sourcefn residual_mask(&self) -> ResidualSpec
fn residual_mask(&self) -> ResidualSpec
Declare which primal input/output indices this rule reads as tensor residuals. Indices not declared may only be accessed through metadata.
Sourcefn primal_vjp(
&self,
request: SemanticPrimalVjpRequest<'_>,
builder: &mut SemanticProgramBuilder,
) -> Result<Box<[AdValue]>, SemanticAdError>
fn primal_vjp( &self, request: SemanticPrimalVjpRequest<'_>, builder: &mut SemanticProgramBuilder, ) -> Result<Box<[AdValue]>, SemanticAdError>
Emit ordered optional input cotangents into builder.
§Errors
Returns SemanticAdError::Unsupported when the payload is outside
the rule’s supported domain, or SemanticAdError::Build when emitted
semantic operations fail validation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".