Skip to main content

AutodiffModel

Trait AutodiffModel 

Source
pub trait AutodiffModel: Model {
    // Provided methods
    fn forward_autodiff(
        &self,
        input: &ArrayView<'_, f64, Ix2>,
    ) -> TrainResult<()> { ... }
    fn compute_gradients(&self) -> TrainResult<HashMap<String, Array<f64, Ix2>>> { ... }
}
Expand description

Trait for models that support automatic differentiation via scirs2-autograd.

This trait extends the base Model trait with support for training using SciRS2’s automatic differentiation system.

Note: This trait is currently a placeholder for future scirs2-autograd integration. The actual Variable type will be specified once scirs2-autograd is fully integrated.

Provided Methods§

Source

fn forward_autodiff(&self, input: &ArrayView<'_, f64, Ix2>) -> TrainResult<()>

Forward pass with autodiff tracking (placeholder).

§Arguments
  • input - Input data array
§Returns

Success indicator (actual implementation will return autodiff Variable)

Source

fn compute_gradients(&self) -> TrainResult<HashMap<String, Array<f64, Ix2>>>

Compute gradients automatically using backward pass (placeholder).

§Returns

Gradients for all parameters

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§