oa::ml::flow::masked_mse

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.

FnRust public API

Function Documentation

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.