oa::ml::flow

Module published by the oa::ml module.

MdRust public API

Public Types

Public Functions

pub fn euler_step( state: &Matrix, velocity: &Matrix, delta_time: f32, ) -> Result<Matrix>
pub fn linear_match( clean: &Matrix, noise: &Matrix, time: &Matrix, ) -> Result<FlowMatchBatch>
pub fn masked_mse( prediction: &Matrix, target: &Matrix, mask: &Matrix, ) -> Result<Matrix>

Function Documentation

pub fn euler_step( state: &Matrix, velocity: &Matrix, delta_time: f32 ) -> Result<Matrix>
Advance one explicit Euler step: state + velocity * delta_time. Errors Returns an error unless state and velocity are matching nonempty same-engine F32 matrices, delta_time is finite, and recording succeeds.
pub fn linear_match( clean: &Matrix, noise: &Matrix, time: &Matrix ) -> Result<FlowMatchBatch>
Construct x(t) = clean + t * (noise - clean) and v = noise - clean. A rank-one time vector matching the batch dimension expands across every non-batch axis. Scalars and ordinarily broadcastable time shapes are also accepted. Errors Returns an error unless every input is same-engine F32, clean and noise are matching and nonempty, time broadcasts to them, and recording succeeds.
pub fn masked_mse( prediction: &Matrix, target: &Matrix, mask: &Matrix ) -> Result<Matrix>
Compute mean squared error over broadcast-selected valid elements. The mask contributes its values to the denominator. An all-zero mask returns exact zero by clamping the denominator to one. Target and mask are detached; reverse mode differentiates only prediction. Errors Returns an error unless prediction and target are matching nonempty same-engine F32 matrices, mask is same-engine F32 and broadcastable to prediction, and recording succeeds.