π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add goldens based self-test of EP during model load
laurenspriem6b51a752fa1e
diff --git a/infra/ml/test/ml_indexing/assets.json b/infra/ml/test/ml_indexing/assets.jsonindex e8c427b8a0..7038f604a8 100644--- a/infra/ml/test/ml_indexing/assets.json+++ b/infra/ml/test/ml_indexing/assets.json@@ -50,6 +50,16 @@"file_name": "mobileclip_s2_image_gelu_opset20.onnx","url": "https://models.ente.com/mobileclip_s2_image_gelu_opset20.onnx","sha256": "205a430af825e501c5138e5bb9abea942482a7a4fd4a680e98e47cf0830dce7e"+ },+ "clip_text": {+ "file_name": "mobileclip_s2_text_opset18_quant.onnx",+ "url": "https://models.ente.com/mobileclip_s2_text_opset18_quant.onnx",+ "sha256": "d92f33dfcff83077fc2e0d3414250710efbb51795dfd89767bdbefb5fdc47322"+ },+ "clip_text_vocab": {+ "file_name": "bpe_simple_vocab_16e6.txt",+ "url": "https://models.ente.com/bpe_simple_vocab_16e6.txt",+ "sha256": "67603cfda2e032ad77b5f8808af37789d590db664b26df8705d2bf8b3c553fc8"}},"expected_unsupported_decode_file_ids": ["IMG_8905.CR2"],diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_computer.dart b/mobile/apps/photos/lib/services/machine_learning/ml_computer.dartindex bb10a77959..487752c703 100644--- a/mobile/apps/photos/lib/services/machine_learning/ml_computer.dart+++ b/mobile/apps/photos/lib/services/machine_learning/ml_computer.dart@@ -9,6 +9,7 @@ import "package:photos/models/ml/vector.dart";import "package:photos/services/machine_learning/ml_constants.dart";import "package:photos/services/machine_learning/ml_model_assets.dart";import "package:photos/services/machine_learning/ml_model_download_service.dart";+import "package:photos/services/machine_learning/ml_runtime_events.dart";import "package:photos/services/machine_learning/semantic_search/query_result.dart";import "package:photos/services/machine_learning/webgpu_execution_policy.dart";import "package:photos/services/remote_assets_service.dart";@@ -84,12 +85,17 @@ class MLComputer extends SuperIsolate {);}final enableWebGpu = await webGpuExecutionPolicy.isEligible();- final isolateResult = await runInIsolate(IsolateOperation.runClipText, {- "text": query,- "clipTextModelPath": modelPath,- "clipTextVocabPath": vocabPath,- "enableWebGpu": enableWebGpu,- });+ final dynamic isolateResult;+ try {+ isolateResult = await runInIsolate(IsolateOperation.runClipText, {+ "text": query,+ "clipTextModelPath": modelPath,+ "clipTextVocabPath": vocabPath,+ "enableWebGpu": enableWebGpu,+ });+ } finally {+ await logRustMlRuntimeEvents();+ }if (isolateResult is RustCorruptModelCacheDeletedException) {_clipTextModelPath = null;MLModelDownloadService.instance.invalidateModelDownloadCache(diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart b/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dartindex 7d72a4c7d1..7c5a4f7a95 100644--- a/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart+++ b/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart@@ -5,6 +5,7 @@ import "package:photos/services/machine_learning/ml_model_assets.dart";import "package:photos/services/machine_learning/ml_model_download_service.dart";import "package:photos/services/machine_learning/ml_models_overview.dart";import "package:photos/services/machine_learning/ml_result.dart";+import "package:photos/services/machine_learning/ml_runtime_events.dart";import "package:photos/services/machine_learning/webgpu_execution_policy.dart";import "package:photos/services/remote_assets_service.dart";import "package:photos/utils/isolate/isolate_operations.dart";@@ -51,15 +52,20 @@ class MLIndexingIsolate extends SuperIsolate {final enableWebGpu = await webGpuExecutionPolicy.isEligible();_logger.info("Analyzing image ${instruction.fileKey} with Rust ML");- final isolateResult = await runInIsolate(IsolateOperation.analyzeImage, {- "enteFileID": instruction.fileKey,- "filePath": filePath,- "runFaces": instruction.shouldRunFaces,- "runClip": instruction.shouldRunClip,- "runPets": instruction.shouldRunPets,- ...rustRuntimeArgs,- "enableWebGpu": enableWebGpu,- });+ final dynamic isolateResult;+ try {+ isolateResult = await runInIsolate(IsolateOperation.analyzeImage, {+ "enteFileID": instruction.fileKey,+ "filePath": filePath,+ "runFaces": instruction.shouldRunFaces,+ "runClip": instruction.shouldRunClip,+ "runPets": instruction.shouldRunPets,+ ...rustRuntimeArgs,+ "enableWebGpu": enableWebGpu,+ });+ } finally {+ await logRustMlRuntimeEvents();+ }if (isolateResult is RustCorruptModelCacheDeletedException) {_logger.warning("Deleted corrupt Rust ONNX model cache at ${isolateResult.modelPath}; "diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_runtime_events.dart b/mobile/apps/photos/lib/services/machine_learning/ml_runtime_events.dartnew file mode 100644index 0000000000..e1fadfd5af--- /dev/null+++ b/mobile/apps/photos/lib/services/machine_learning/ml_runtime_events.dart@@ -0,0 +1,35 @@+import "package:photos/utils/isolate/isolate_operations.dart";+import "package:photos/utils/isolate/super_isolate.dart";++/// Surfaces notable Rust ML runtime events (execution provider fallbacks,+/// golden self-test failures) in the app logs.+///+/// The Rust runtime degrades gracefully without failing the calling+/// operation, so these events are the only signal that a device is running+/// ML in a degraded or misbehaving configuration.+extension MlRuntimeEventLogging on SuperIsolate {+ /// Drains the Rust runtime's process-wide event buffer and logs each event+ /// at its severity. Call after ML operations; best-effort.+ Future<void> logRustMlRuntimeEvents() async {+ try {+ final result = await runInIsolate(+ IsolateOperation.takeMlRuntimeEvents,+ {},+ );+ for (final event in (result as List?) ?? const []) {+ final map = event as Map;+ final message = "Rust ML runtime: ${map["message"]}";+ switch (map["severity"]) {+ case "severe":+ logger.severe(message);+ case "warning":+ logger.warning(message);+ default:+ logger.info(message);+ }+ }+ } catch (e, s) {+ logger.warning("Failed to take Rust ML runtime events", e, s);+ }+ }+}diff --git a/mobile/apps/photos/lib/utils/isolate/isolate_operations.dart b/mobile/apps/photos/lib/utils/isolate/isolate_operations.dartindex 886ae42a8c..b98f0491f9 100644--- a/mobile/apps/photos/lib/utils/isolate/isolate_operations.dart+++ b/mobile/apps/photos/lib/utils/isolate/isolate_operations.dart@@ -42,6 +42,9 @@ enum IsolateOperation {/// [MLIndexingIsolate]releaseRustMlRuntime,+ /// [MLIndexingIsolate] and [MLComputer]+ takeMlRuntimeEvents,+/// [MLComputer]generateFaceThumbnails,@@ -135,6 +138,16 @@ Future<dynamic> isolateFunction(await _releaseRustRuntime();return true;+ /// MLIndexingIsolate and MLComputer+ case IsolateOperation.takeMlRuntimeEvents:+ await _ensureRustLoaded();+ final events = await rust_ml.takeMlRuntimeEvents();+ return events+ .map(+ (event) => {"severity": event.severity, "message": event.message},+ )+ .toList();+/// Cases for MLIndexingIsolate stop here/// Cases for MLComputer start herediff --git a/rust/bindings/frb/photos/src/api/ml_indexing_api.rs b/rust/bindings/frb/photos/src/api/ml_indexing_api.rsindex 5822f935ef..b69fa1d894 100644--- a/rust/bindings/frb/photos/src/api/ml_indexing_api.rs+++ b/rust/bindings/frb/photos/src/api/ml_indexing_api.rs@@ -187,6 +187,27 @@ pub fn tokenize_clip_text_rust(text: String, vocab_path: String) -> Result<Vec<ishared_indexing::tokenize_clip_text(&text, &vocab_path).map_err(|e| e.to_string())}+/// A notable ML runtime event (execution provider fallback, golden self-test+/// failure) buffered by the Rust runtime for app-side logging. `severity` is+/// one of "info", "warning", or "severe".+#[derive(Clone, Debug)]+pub struct RustMlRuntimeEvent {+ pub severity: String,+ pub message: String,+}++/// Drains buffered ML runtime events. The buffer is process-wide, so drain+/// after ML operations and log each event at its severity.+pub fn take_ml_runtime_events() -> Vec<RustMlRuntimeEvent> {+ ente_photos::ml::events::take_events()+ .into_iter()+ .map(|event| RustMlRuntimeEvent {+ severity: event.severity.as_str().to_string(),+ message: event.message,+ })+ .collect()+}+fn to_model_paths(paths: &RustModelPaths) -> ModelPaths {ModelPaths {face_detection: paths.face_detection.clone(),diff --git a/rust/crates/photos/Cargo.toml b/rust/crates/photos/Cargo.tomlindex 944a34c265..783af6a314 100644--- a/rust/crates/photos/Cargo.toml+++ b/rust/crates/photos/Cargo.toml@@ -73,3 +73,8 @@ tempfile = "3.12"name = "ml_indexing"path = "tests/ml_indexing.rs"required-features = ["ml-assets"]++[[test]]+name = "ml_goldens"+path = "tests/ml_goldens.rs"+required-features = ["ml-assets"]diff --git a/rust/crates/photos/src/ml/events.rs b/rust/crates/photos/src/ml/events.rsnew file mode 100644index 0000000000..a476004cc7--- /dev/null+++ b/rust/crates/photos/src/ml/events.rs@@ -0,0 +1,88 @@+//! Bounded buffer of notable ML runtime events for the app layer.+//!+//! The Rust runtime degrades gracefully (execution provider fallbacks, golden+//! self-test failures, WebGPU quarantine) without failing the calling+//! operation, so the app would otherwise never learn that a device is running+//! in a degraded or misbehaving configuration. Callers record events here and+//! the app drains them via `take_events` after ML operations, logging them at+//! the appropriate severity.++use std::sync::Mutex;++/// Oldest events are dropped first once the buffer is full; a drop is only+/// possible when the app has not drained for many sessions, in which case the+/// newest events are the actionable ones.+const MAX_BUFFERED_EVENTS: usize = 64;++#[derive(Clone, Debug, PartialEq, Eq)]+pub enum Severity {+ Info,+ Warning,+ Severe,+}++impl Severity {+ pub fn as_str(&self) -> &'static str {+ match self {+ Self::Info => "info",+ Self::Warning => "warning",+ Self::Severe => "severe",+ }+ }+}++#[derive(Clone, Debug)]+pub struct MlRuntimeEvent {+ pub severity: Severity,+ pub message: String,+}++static EVENTS: Mutex<Vec<MlRuntimeEvent>> = Mutex::new(Vec::new());++/// Records an event for the app layer and mirrors it to the runtime log.+pub(crate) fn record(severity: Severity, message: String) {+ crate::ml::runtime::rt_log(&format!("[{}] {message}", severity.as_str()));+ let mut events = EVENTS+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner());+ if events.len() >= MAX_BUFFERED_EVENTS {+ events.remove(0);+ }+ events.push(MlRuntimeEvent { severity, message });+}++/// Returns all buffered events, leaving the buffer empty.+pub fn take_events() -> Vec<MlRuntimeEvent> {+ let mut events = EVENTS+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner());+ std::mem::take(&mut *events)+}++#[cfg(test)]+mod tests {+ use super::{MAX_BUFFERED_EVENTS, Severity, record, take_events};++ /// A single test because the buffer is a process-global shared with any+ /// concurrently running test that records events.+ #[test]+ fn records_in_order_drains_on_take_and_drops_oldest_when_full() {+ take_events();+ record(Severity::Info, "first".to_string());+ record(Severity::Severe, "second".to_string());++ let events = take_events();+ assert_eq!(events.len(), 2);+ assert_eq!(events[0].severity, Severity::Info);+ assert_eq!(events[0].message, "first");+ assert_eq!(events[1].severity, Severity::Severe);+ assert!(take_events().is_empty());++ for index in 0..(MAX_BUFFERED_EVENTS + 3) {+ record(Severity::Info, format!("event {index}"));+ }+ let events = take_events();+ assert_eq!(events.len(), MAX_BUFFERED_EVENTS);+ assert_eq!(events[0].message, "event 3");+ }+}diff --git a/rust/crates/photos/src/ml/golden.rs b/rust/crates/photos/src/ml/golden.rsnew file mode 100644index 0000000000..0bde28957d--- /dev/null+++ b/rust/crates/photos/src/ml/golden.rs@@ -0,0 +1,571 @@+//! Golden-output self-tests for accelerated ONNX execution providers.+//!+//! GPU drivers and execution providers can produce numerically wrong output+//! while reporting success (for example, finite garbage from stale pipeline+//! state, or fp16 overflow). Wrong embeddings would be persisted server-side+//! and silently poison search and clustering, so before an accelerated+//! session (WebGPU on Android, CoreML on iOS) is trusted, it must reproduce a+//! committed golden output for a fixed input within a cosine-distance+//! threshold. The golden outputs are generated on the CPU execution provider+//! by `cargo test -p ente-photos --features ml-assets --test ml_goldens`+//! and committed in `golden_data.rs`. A cheap unit test in `golden_tooling`+//! keeps the committed entries pinned (by file name and content hash) to the+//! production models in `infra/ml/test/ml_indexing/assets.json`, so a model+//! update cannot ship without regenerating the goldens.+//!+//! Inputs are deterministic seeded noise (token ids for CLIP text): the+//! models are pure tensor programs without data-dependent control flow, so+//! any fixed input exercises the same kernels as a real photo, and a shared+//! generation function makes device and generator inputs bit-identical.++use crate::ml::golden_data::GOLDEN_ENTRIES;++/// Maximum cosine distance between an accelerated session's embedding output+/// and the CPU-generated golden output before the session is rejected.+/// Healthy fp16 provider divergence is around 1e-3; corrupted output is+/// orders of magnitude beyond this (random vectors sit near 1.0). The+/// threshold is deliberately loose β a false rejection silently degrades the+/// device to CPU, which is worse than letting marginal-but-healthy numerics+/// through.+pub(crate) const COSINE_DISTANCE_THRESHOLD: f64 = 0.025;++/// Maximum relative L2 error (`|actual - expected| / |expected|`) for each+/// detector output channel group. Unlike cosine distance this also rejects+/// magnitude corruption, which matters for outputs whose absolute values are+/// consumed directly (box coordinates, scores). Healthy fp16 divergence is+/// around 1e-3 here too; the same loose-threshold rationale as for cosine+/// distance applies.+pub(crate) const RELATIVE_L2_THRESHOLD: f64 = 0.025;++/// Reference outputs are compared on a deterministic strided sample capped at+/// this many elements, so large detector outputs stay small in the committed+/// golden data. Embedding outputs fit entirely below the cap.+const MAX_REFERENCE_SAMPLES: usize = 4096;++/// The fixed input for a golden self-test.+pub enum GoldenInput {+ /// Uniform [0, 1) noise from [`seeded_noise`], sized to `input_shape`.+ SeededF32 { seed: u64 },+ /// Pre-tokenized CLIP text token ids.+ I32 { data: &'static [i32] },+}++/// How a model's output is compared against its golden output.+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub enum GoldenMetric {+ /// For embedding outputs, which downstream code consumes via cosine+ /// similarity; scale differences are irrelevant there.+ CosineDistance,+ /// For detector rows whose confidence values are much smaller than their+ /// coordinates. Confidence and all remaining values are compared+ /// separately so coordinate magnitudes cannot hide score corruption.+ DetectorRelativeL2 {+ row_len: usize,+ confidence_offset: usize,+ },+}++impl GoldenMetric {+ pub fn label(self) -> &'static str {+ match self {+ Self::CosineDistance => "cosine distance",+ Self::DetectorRelativeL2 { .. } => "detector channel relative L2 error",+ }+ }+}++/// A committed golden record for one model file.+pub struct GoldenEntry {+ /// The model's canonical file name; entries are keyed by file name so+ /// that a model update (which changes the file name) can never silently+ /// reuse a stale golden: the lookup misses and the accelerated provider+ /// is denied.+ pub model_file: &'static str,+ /// SHA-256 of the model file's contents, copied from the asset lock+ /// (`infra/ml/test/ml_indexing/assets.json`) at generation time. Not+ /// checked on device; a cheap unit test in `golden_tooling` compares it+ /// against the asset lock so that a model content change β even under an+ /// unchanged file name β fails CI until the goldens are regenerated.+ pub model_sha256: &'static str,+ pub input: GoldenInput,+ pub input_shape: &'static [i64],+ pub metric: GoldenMetric,+ /// Length of the model's full first output, used to derive the sample+ /// stride and to reject outputs of unexpected shape.+ pub output_len: usize,+ /// Strided sample of the CPU-generated first output.+ pub expected_sample: &'static [f32],+}++/// Finds the golden entry for a model path. `None` means the model must not+/// run on an accelerated execution provider.+pub fn lookup(model_path: &str) -> Option<&'static GoldenEntry> {+ let file_name = std::path::Path::new(model_path).file_name()?.to_str()?;+ GOLDEN_ENTRIES+ .iter()+ .find(|entry| matches_model_file(file_name, entry.model_file))+}++/// The app stores downloaded models under URL-derived sanitized names (see+/// `RemoteAssetsService._urlToFileName` in the photos app): the protocol is+/// stripped and every character outside `[A-Za-z0-9_]` β including dots β+/// becomes `_`, e.g. `models_ente_com_yolov5s_face_640_640_static_b1_onnx`.+/// An entry therefore matches when the sanitized on-disk name equals the+/// sanitized canonical name, or ends with it at an `_` boundary (the URL host+/// prefix). Exact canonical names (tests, tooling) also match.+fn matches_model_file(file_name: &str, model_file: &str) -> bool {+ if file_name == model_file {+ return true;+ }+ let sanitized_name = sanitize_file_name(file_name);+ let sanitized_model = sanitize_file_name(model_file);+ sanitized_name == sanitized_model+ || sanitized_name+ .strip_suffix(&sanitized_model)+ .is_some_and(|prefix| prefix.ends_with('_'))+}++fn sanitize_file_name(value: &str) -> String {+ value+ .chars()+ .map(|character| {+ if character.is_ascii_alphanumeric() || character == '_' {+ character+ } else {+ '_'+ }+ })+ .collect()+}++/// A golden input materialized for one inference run. Built identically by+/// the on-device self-test and the golden generator.+pub enum PreparedGoldenInput {+ F32(Vec<f32>),+ I32(Vec<i32>),+}++/// Materializes the entry's fixed input tensor data.+pub fn prepare_input(entry: &GoldenEntry) -> Result<PreparedGoldenInput, String> {+ let element_count: i64 = entry.input_shape.iter().product();+ let element_count = usize::try_from(element_count)+ .map_err(|_| format!("invalid golden input shape {:?}", entry.input_shape))?;+ match &entry.input {+ GoldenInput::SeededF32 { seed } => {+ Ok(PreparedGoldenInput::F32(seeded_noise(*seed, element_count)))+ }+ GoldenInput::I32 { data } => {+ if data.len() != element_count {+ return Err(format!(+ "golden token count {} does not match input shape {:?}",+ data.len(),+ entry.input_shape+ ));+ }+ Ok(PreparedGoldenInput::I32(data.to_vec()))+ }+ }+}++/// Deterministic uniform [0, 1) noise shared by the on-device self-test and+/// the golden generator. xorshift64*; must never change without regenerating+/// `golden_data.rs`.+pub fn seeded_noise(seed: u64, len: usize) -> Vec<f32> {+ let mut state = seed.max(1);+ (0..len)+ .map(|_| {+ state ^= state << 13;+ state ^= state >> 7;+ state ^= state << 17;+ let value = state.wrapping_mul(0x2545_F491_4F6C_DD1D);+ // Use the top 24 bits for an exactly representable f32 in [0, 1).+ (value >> 40) as f32 / (1u32 << 24) as f32+ })+ .collect()+}++/// The deterministic sample of a full output that golden entries store and+/// self-tests compare against.+pub fn sample_output(output: &[f32]) -> Vec<f32> {+ let stride = sample_stride(output.len());+ output.iter().copied().step_by(stride).collect()+}++fn sample_stride(output_len: usize) -> usize {+ output_len.div_ceil(MAX_REFERENCE_SAMPLES).max(1)+}++/// Compares a session's full first output against a golden entry using the+/// entry's metric. Returns the measured distance, or a description of why the+/// output is rejected.+pub fn compare_output(entry: &GoldenEntry, output: &[f32]) -> Result<f64, String> {+ if output.len() != entry.output_len {+ return Err(format!(+ "output length {} does not match golden length {}",+ output.len(),+ entry.output_len+ ));+ }++ let sample = sample_output(output);+ if sample.len() != entry.expected_sample.len() {+ return Err(format!(+ "output sample length {} does not match golden sample length {}",+ sample.len(),+ entry.expected_sample.len()+ ));+ }+ if let Some(bad) = sample.iter().find(|value| !value.is_finite()) {+ return Err(format!("output contains non-finite values ({bad})"));+ }++ let distance = match entry.metric {+ GoldenMetric::CosineDistance => ensure_within_threshold(+ "output cosine distance",+ cosine_distance(&sample, entry.expected_sample)?,+ COSINE_DISTANCE_THRESHOLD,+ )?,+ GoldenMetric::DetectorRelativeL2 {+ row_len,+ confidence_offset,+ } => {+ let (confidence_distance, remaining_distance) = detector_relative_l2_errors(+ &sample,+ entry.expected_sample,+ entry.output_len,+ row_len,+ confidence_offset,+ )?;+ ensure_within_threshold(+ "detector confidence relative L2 error",+ confidence_distance,+ RELATIVE_L2_THRESHOLD,+ )?;+ ensure_within_threshold(+ "detector remaining-output relative L2 error",+ remaining_distance,+ RELATIVE_L2_THRESHOLD,+ )?;+ confidence_distance.max(remaining_distance)+ }+ };+ Ok(distance)+}++fn ensure_within_threshold(label: &str, distance: f64, threshold: f64) -> Result<f64, String> {+ if distance > threshold {+ return Err(format!(+ "{label} {distance:.6} exceeds threshold {threshold}"+ ));+ }+ Ok(distance)+}++fn detector_relative_l2_errors(+ actual_sample: &[f32],+ expected_sample: &[f32],+ output_len: usize,+ row_len: usize,+ confidence_offset: usize,+) -> Result<(f64, f64), String> {+ if row_len == 0 || confidence_offset >= row_len {+ return Err(format!(+ "invalid detector layout: row length {row_len}, confidence offset {confidence_offset}"+ ));+ }+ if !output_len.is_multiple_of(row_len) {+ return Err(format!(+ "detector output length {output_len} is not divisible by row length {row_len}"+ ));+ }++ let stride = sample_stride(output_len);+ let mut actual_confidences = Vec::new();+ let mut expected_confidences = Vec::new();+ let mut actual_remaining = Vec::new();+ let mut expected_remaining = Vec::new();+ for (sample_index, (&actual, &expected)) in+ actual_sample.iter().zip(expected_sample).enumerate()+ {+ let output_index = sample_index * stride;+ if output_index % row_len == confidence_offset {+ actual_confidences.push(actual);+ expected_confidences.push(expected);+ } else {+ actual_remaining.push(actual);+ expected_remaining.push(expected);+ }+ }+ if actual_confidences.is_empty() {+ return Err("detector golden sample contains no confidence values".to_string());+ }+ if actual_remaining.is_empty() {+ return Err("detector golden sample contains no non-confidence values".to_string());+ }++ Ok((+ relative_l2_error(&actual_confidences, &expected_confidences)?,+ relative_l2_error(&actual_remaining, &expected_remaining)?,+ ))+}++fn cosine_distance(actual_sample: &[f32], expected_sample: &[f32]) -> Result<f64, String> {+ let mut dot = 0.0f64;+ let mut actual_norm_squared = 0.0f64;+ let mut expected_norm_squared = 0.0f64;+ for (actual, expected) in actual_sample.iter().zip(expected_sample) {+ let actual = f64::from(*actual);+ let expected = f64::from(*expected);+ dot += actual * expected;+ actual_norm_squared += actual * actual;+ expected_norm_squared += expected * expected;+ }++ let denominator = (actual_norm_squared * expected_norm_squared).sqrt();+ if denominator <= f64::MIN_POSITIVE {+ return Err("output or golden sample is a zero vector".to_string());+ }+ Ok(1.0 - (dot / denominator).clamp(-1.0, 1.0))+}++fn relative_l2_error(actual_sample: &[f32], expected_sample: &[f32]) -> Result<f64, String> {+ let mut error_squared = 0.0f64;+ let mut expected_norm_squared = 0.0f64;+ for (actual, expected) in actual_sample.iter().zip(expected_sample) {+ let actual = f64::from(*actual);+ let expected = f64::from(*expected);+ let difference = actual - expected;+ error_squared += difference * difference;+ expected_norm_squared += expected * expected;+ }++ if expected_norm_squared.sqrt() <= f64::MIN_POSITIVE {+ return Err("golden sample is a zero vector".to_string());+ }+ Ok((error_squared / expected_norm_squared).sqrt())+}++#[cfg(test)]+mod tests {+ use super::{+ COSINE_DISTANCE_THRESHOLD, GOLDEN_ENTRIES, GoldenEntry, GoldenInput, GoldenMetric,+ compare_output, matches_model_file, seeded_noise,+ };++ fn entry_with_metric(+ metric: GoldenMetric,+ expected_sample: &'static [f32],+ output_len: usize,+ ) -> GoldenEntry {+ GoldenEntry {+ model_file: "model.onnx",+ model_sha256: "0000000000000000000000000000000000000000000000000000000000000000",+ input: GoldenInput::SeededF32 { seed: 7 },+ input_shape: &[1, 4],+ metric,+ output_len,+ expected_sample,+ }+ }++ fn entry_for(expected_sample: &'static [f32], output_len: usize) -> GoldenEntry {+ entry_with_metric(GoldenMetric::CosineDistance, expected_sample, output_len)+ }++ /// Downloaded models are stored under URL-derived sanitized names; the+ /// canonical name must match both those and its plain form.+ #[test]+ fn matches_canonical_and_app_sanitized_model_file_names() {+ const CANONICAL: &str = "yolov5s_face_640_640_static_b1.onnx";+ assert!(matches_model_file(CANONICAL, CANONICAL));+ assert!(matches_model_file(+ "models_ente_com_yolov5s_face_640_640_static_b1_onnx",+ CANONICAL+ ));+ assert!(matches_model_file(+ "models_ente_io_yolov5s_face_640_640_static_b1_onnx",+ CANONICAL+ ));++ assert!(!matches_model_file(+ "models_ente_com_mobileclip_s2_image_gelu_opset20_onnx",+ CANONICAL+ ));+ // A different model whose name merely contains the canonical name+ // without an underscore boundary must not match.+ assert!(!matches_model_file(+ "models_ente_com_xyolov5s_face_640_640_static_b1_onnx",+ CANONICAL+ ));+ }++ /// No committed entry may match another entry's on-device name, otherwise+ /// a model could be validated against the wrong golden.+ #[test]+ fn committed_entries_are_unambiguous_for_app_sanitized_names() {+ for entry in GOLDEN_ENTRIES {+ let device_name = format!(+ "models_ente_com_{}",+ super::sanitize_file_name(entry.model_file)+ );+ let matching = GOLDEN_ENTRIES+ .iter()+ .filter(|candidate| matches_model_file(&device_name, candidate.model_file))+ .count();+ assert_eq!(matching, 1, "ambiguous golden entry for {device_name}");+ }+ }++ #[test]+ fn seeded_noise_is_deterministic_and_in_unit_range() {+ let first = seeded_noise(42, 1000);+ let second = seeded_noise(42, 1000);+ assert_eq!(first, second);+ assert!(first.iter().all(|value| (0.0..1.0).contains(value)));+ assert_ne!(first, seeded_noise(43, 1000));+ // Not degenerate: values actually vary.+ assert!(first.iter().any(|value| *value > 0.9));+ assert!(first.iter().any(|value| *value < 0.1));+ }++ #[test]+ fn accepts_output_close_to_golden() {+ static EXPECTED: [f32; 4] = [0.5, -1.0, 2.0, 0.25];+ let entry = entry_for(&EXPECTED, 4);+ let output = [0.5001, -0.9999, 2.0002, 0.2501];++ let distance = compare_output(&entry, &output).unwrap();+ assert!(distance < COSINE_DISTANCE_THRESHOLD);+ }++ #[test]+ fn rejects_output_far_from_golden() {+ static EXPECTED: [f32; 4] = [0.5, -1.0, 2.0, 0.25];+ let entry = entry_for(&EXPECTED, 4);+ let output = [-0.5, 1.0, -2.0, 0.25];++ let error = compare_output(&entry, &output).unwrap_err();+ assert!(error.contains("cosine distance"), "{error}");+ }++ #[test]+ fn rejects_output_of_unexpected_length() {+ static EXPECTED: [f32; 4] = [0.5, -1.0, 2.0, 0.25];+ let entry = entry_for(&EXPECTED, 4);++ let error = compare_output(&entry, &[0.5, -1.0]).unwrap_err();+ assert!(error.contains("length"), "{error}");+ }++ #[test]+ fn rejects_non_finite_output() {+ static EXPECTED: [f32; 4] = [0.5, -1.0, 2.0, 0.25];+ let entry = entry_for(&EXPECTED, 4);++ let error = compare_output(&entry, &[0.5, f32::NAN, 2.0, 0.25]).unwrap_err();+ assert!(error.contains("non-finite"), "{error}");+ }++ #[test]+ fn rejects_zero_output() {+ static EXPECTED: [f32; 4] = [0.5, -1.0, 2.0, 0.25];+ let entry = entry_for(&EXPECTED, 4);++ let error = compare_output(&entry, &[0.0; 4]).unwrap_err();+ assert!(error.contains("zero vector"), "{error}");+ }++ /// Cosine is scale-invariant by design (embedding consumers normalize),+ /// so the detector entries must use relative L2, which rejects+ /// magnitude-corrupted output.+ #[test]+ fn relative_l2_rejects_scale_corrupted_output_that_cosine_accepts() {+ static EXPECTED: [f32; 4] = [0.5, -1.0, 2.0, 0.25];+ let scaled = [1.0, -2.0, 4.0, 0.5];++ let cosine_entry = entry_for(&EXPECTED, 4);+ assert!(compare_output(&cosine_entry, &scaled).is_ok());++ let l2_entry = entry_with_metric(+ GoldenMetric::DetectorRelativeL2 {+ row_len: 2,+ confidence_offset: 1,+ },+ &EXPECTED,+ 4,+ );+ let error = compare_output(&l2_entry, &scaled).unwrap_err();+ assert!(error.contains("relative L2"), "{error}");+ }++ #[test]+ fn relative_l2_accepts_output_close_to_golden() {+ static EXPECTED: [f32; 4] = [0.5, -1.0, 2.0, 0.25];+ let entry = entry_with_metric(+ GoldenMetric::DetectorRelativeL2 {+ row_len: 2,+ confidence_offset: 1,+ },+ &EXPECTED,+ 4,+ );+ let output = [0.5001, -0.9999, 2.0002, 0.2501];++ let distance = compare_output(&entry, &output).unwrap();+ assert!(distance < super::RELATIVE_L2_THRESHOLD);+ }++ fn detector_entry(expected_sample: &'static [f32]) -> GoldenEntry {+ entry_with_metric(+ GoldenMetric::DetectorRelativeL2 {+ row_len: 16,+ confidence_offset: 4,+ },+ expected_sample,+ expected_sample.len(),+ )+ }++ #[test]+ fn detector_metric_rejects_all_zero_confidences() {+ static EXPECTED: [f32; 32] = [+ 100.0, 100.0, 20.0, 20.0, 0.001, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0,+ 19.0, 0.98, 200.0, 200.0, 40.0, 40.0, 0.002, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0,+ 27.0, 28.0, 29.0, 0.99,+ ];+ let entry = detector_entry(&EXPECTED);+ let mut output = EXPECTED;+ for confidence in output.iter_mut().skip(4).step_by(16) {+ *confidence = 0.0;+ }++ let error = compare_output(&entry, &output).unwrap_err();+ assert!(error.contains("detector confidence"), "{error}");+ }++ #[test]+ fn detector_metric_rejects_all_one_confidences() {+ static EXPECTED: [f32; 32] = [+ 100.0, 100.0, 20.0, 20.0, 0.001, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0,+ 19.0, 0.98, 200.0, 200.0, 40.0, 40.0, 0.002, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0,+ 27.0, 28.0, 29.0, 0.99,+ ];+ let entry = detector_entry(&EXPECTED);+ let mut output = EXPECTED;+ for confidence in output.iter_mut().skip(4).step_by(16) {+ *confidence = 1.0;+ }++ let error = compare_output(&entry, &output).unwrap_err();+ assert!(error.contains("detector confidence"), "{error}");+ }++ #[test]+ fn samples_large_outputs_with_a_deterministic_stride() {+ let output: Vec<f32> = (0..10_000).map(|index| index as f32).collect();+ let sample = super::sample_output(&output);+ assert_eq!(sample.len(), output.len().div_ceil(3));+ assert_eq!(sample[0], 0.0);+ assert_eq!(sample[1], 3.0);+ }+}diff --git a/rust/crates/photos/src/ml/golden_data.rs b/rust/crates/photos/src/ml/golden_data.rsnew file mode 100644index 0000000000..f0082f3cfd--- /dev/null+++ b/rust/crates/photos/src/ml/golden_data.rs@@ -0,0 +1,5358 @@+//! GENERATED FILE β do not edit by hand.+//!+//! Regenerate with:+//! cargo test -p ente-photos --features ml-assets --test ml_goldens -- --ignored generate_goldens+//!+//! TODO: the pet models are CPU-only and therefore have no golden entries+//! yet; they must get entries here before they are moved off CPU-only+//! execution (see `MlRuntime::new` in runtime.rs).++use crate::ml::golden::{GoldenEntry, GoldenInput, GoldenMetric};++pub(crate) static GOLDEN_ENTRIES: &[GoldenEntry] = &[+ GoldenEntry {+ model_file: "yolov5s_face_640_640_static_b1.onnx",+ model_sha256: "e047647409403d52696035ecd445792173e50d7fbdcccac97b958a585db9aa3d",+ input: GoldenInput::SeededF32 {+ seed: 0x601de25eed2026,+ },+ input_shape: &[1, 3, 640, 640],+ metric: GoldenMetric::DetectorRelativeL2 {+ row_len: 16,+ confidence_offset: 4,+ },+ output_len: 403200,+ expected_sample: &[+ 4.133195,+ 19.90008,+ 4.6455154,+ 148.88896,+ 6.3157444,+ 0.98281336,+ 15.838728,+ 347.102,+ 4.487977,+ 443.4129,+ 4.3860064,+ 5.725815,+ 1.1920929e-6,+ 6.126792,+ 14.716088,+ 101.137634,+ 155.55972,+ 19.975569,+ 10.64748,+ 301.36963,+ 16.649036,+ 0.9829082,+ 15.766748,+ 499.59967,+ 10.397724,+ 596.37115,+ 21.053528,+ 20.689596,+ 2.5629997e-6,+ 157.12408,+ 22.629,+ 251.94417,+ 308.01617,+ 19.981642,+ 20.048407,+ 451.74286,+ 22.037558,+ 0.98286813,+ 15.59356,+ 9.962267,+ 28.038708,+ 107.39082,+ 31.44375,+ 28.718468,+ 5.403161e-5,+ 308.209,+ 30.493689,+ 404.6116,+ 460.24042,+ 19.791042,+ 28.535233,+ 609.5159,+ 38.133995,+ 0.9828012,+ 15.603436,+ 162.01108,+ 36.544064,+ 259.40298,+ 38.888554,+ 36.54167,+ 3.0100346e-6,+ 460.72528,+ 37.090004,+ 559.4118,+ 612.4412,+ 19.990465,+ 43.77471,+ 116.18644,+ 47.082188,+ 0.98278725,+ 15.056313,+ 315.73807,+ 43.473568,+ 411.0902,+ 46.062004,+ 44.16137,+ 4.172325e-7,+ 615.89935,+ 53.54155,+ 68.65501,+ 123.83681,+ 19.994339,+ 51.237797,+ 267.89575,+ 54.73848,+ 0.98284435,+ 15.491502,+ 466.49283,+ 51.94187,+ 564.5765,+ 56.513813,+ 60.522095,+ 3.734231e-5,+ 123.021515,+ 61.124634,+ 220.51294,+ 276.08508,+ 19.980682,+ 60.68579,+ 419.5551,+ 62.27439,+ 0.9827789,+ 15.672413,+ 620.55817,+ 68.0945,+ 75.45141,+ 68.94347,+ 67.21954,+ 2.3841858e-5,+ 275.56833,+ 69.20838,+ 372.04388,+ 427.71814,+ 19.979944,+ 69.52561,+ 573.0119,+ 71.13779,+ 0.98278886,+ 15.481057,+ 130.34471,+ 76.57093,+ 227.44904,+ 78.893105,+ 76.9406,+ 1.2874603e-5,+ 427.77216,+ 77.531136,+ 526.52344,+ 579.9331,+ 19.99332,+ 83.70709,+ 84.83519,+ 86.35692,+ 0.9827877,+ 15.607072,+ 282.03378,+ 83.78831,+ 378.9601,+ 85.70378,+ 82.84728,+ 5.9604645e-7,+ 581.6407,+ 86.34752,+ 34.260117,+ 91.74608,+ 19.975391,+ 92.73663,+ 235.22754,+ 93.66798,+ 0.98279274,+ 15.55504,+ 434.17212,+ 91.91681,+ 532.4163,+ 95.431015,+ 91.8341,+ 6.7174435e-5,+ 91.25729,+ 101.07144,+ 188.60713,+ 243.4794,+ 19.995255,+ 100.12563,+ 388.13815,+ 102.48342,+ 0.98281884,+ 15.587397,+ 587.2916,+ 98.12959,+ 43.75252,+ 109.520996,+ 106.70801,+ 2.861023e-6,+ 244.49348,+ 109.97669,+ 340.8424,+ 395.85345,+ 19.99485,+ 109.10503,+ 540.28546,+ 111.26279,+ 0.9826157,+ 15.654039,+ 98.39673,+ 114.710236,+ 195.29007,+ 117.654305,+ 114.62236,+ 8.076429e-6,+ 396.37888,+ 117.96099,+ 492.1905,+ 548.74835,+ 19.988201,+ 123.17814,+ 51.425053,+ 125.96284,+ 0.9828447,+ 15.510621,+ 250.09805,+ 122.90238,+ 347.6977,+ 125.37435,+ 123.31025,+ 1.3113022e-6,+ 550.02167,+ 125.182846,+ 5.8294945,+ 60.064957,+ 19.99665,+ 132.37862,+ 204.12833,+ 135.71985,+ 0.9828195,+ 15.370622,+ 401.95834,+ 131.86945,+ 500.54407,+ 133.65317,+ 132.28268,+ 9.715557e-6,+ 59.727158,+ 141.96184,+ 158.42165,+ 211.82478,+ 19.991667,+ 140.26158,+ 355.66824,+ 142.0622,+ 0.9828315,+ 15.196176,+ 555.76135,+ 139.87582,+ 12.527999,+ 149.01967,+ 146.82011,+ 1.1920929e-7,+ 214.02435,+ 149.05673,+ 311.77264,+ 364.12326,+ 19.98213,+ 148.55316,+ 508.9186,+ 150.89928,+ 0.9827939,+ 15.382374,+ 66.582886,+ 155.82417,+ 163.48015,+ 158.4547,+ 153.56282,+ 0.0,+ 366.03372,+ 156.64517,+ 463.3337,+ 515.83575,+ 19.995329,+ 155.59352,+ 20.48908,+ 167.02052,+ 0.9827715,+ 15.72154,+ 219.6574,+ 162.67424,+ 315.0048,+ 165.36621,+ 162.12495,+ 2.9802322e-8,+ 519.0401,+ 165.44597,+ 613.961,+ 27.951042,+ 19.992813,+ 172.4152,+ 172.34935,+ 174.98792,+ 0.98285353,+ 15.3819895,+ 370.19998,+ 171.89217,+ 469.7343,+ 174.18245,+ 171.21365,+ 2.3454428e-5,+ 27.952734,+ 182.46822,+ 124.83186,+ 180.44736,+ 19.978163,+ 181.14352,+ 324.7197,+ 182.99414,+ 0.98276466,+ 15.79249,+ 525.77734,+ 178.92009,+ 620.1068,+ 190.28665,+ 187.72572,+ 2.682209e-7,+ 182.61617,+ 191.18384,+ 278.9422,+ 332.2813,+ 19.63416,+ 188.028,+ 478.5447,+ 192.86435,+ 0.98281634,+ 14.556942,+ 35.362045,+ 196.67174,+ 131.65257,+ 199.26875,+ 197.57887,+ 1.7881393e-7,+ 334.99173,+ 199.25426,+ 431.58194,+ 483.68396,+ 19.996334,+ 196.53535,+ 629.9076,+ 208.26024,+ 0.98281044,+ 15.742146,+ 187.8055,+ 204.7731,+ 284.03207,+ 208.4986,+ 204.25252,+ 2.9802322e-8,+ 485.0702,+ 204.63368,+ 581.9233,+ 635.52905,+ 19.99355,+ 213.0264,+ 140.66183,+ 214.46799,+ 0.98282963,+ 15.703247,+ 338.67154,+ 211.63072,+ 436.2915,+ 215.35876,+ 210.30063,+ 6.7949295e-6,+ 638.35205,+ 222.38051,+ 91.97812,+ 148.71878,+ 19.9131,+ 218.94774,+ 292.87442,+ 224.3807,+ 0.9827645,+ 15.6514435,+ 491.60126,+ 221.11725,+ 588.6816,+ 222.64922,+ 228.0324,+ 8.46386e-6,+ 148.64807,+ 228.70605,+ 246.50294,+ 300.9779,+ 19.911238,+ 228.6338,+ 444.78418,+ 231.19627,+ 0.982798,+ 15.166215,+ 4.475175,+ 236.79594,+ 99.475784,+ 237.56287,+ 235.40536,+ 0.0,+ 301.7649,+ 239.39864,+ 398.32135,+ 453.37845,+ 19.98722,+ 236.57857,+ 598.1655,+ 245.46123,+ 0.9827664,+ 15.45595,+ 153.72157,+ 244.28577,+ 251.89641,+ 247.92334,+ 244.9738,+ 5.9604645e-8,+ 453.21594,+ 245.37656,+ 551.32434,+ 604.428,+ 19.991982,+ 251.55954,+ 107.4654,+ 256.0599,+ 0.982744,+ 15.723544,+ 306.44254,+ 253.49347,+ 403.70197,+ 254.63658,+ 251.37247,+ 2.4735928e-6,+ 605.7907,+ 260.4935,+ 60.647903,+ 116.67885,+ 19.986088,+ 262.57736,+ 259.5751,+ 263.78693,+ 0.9828064,+ 15.654795,+ 459.47003,+ 259.28915,+ 557.86694,+ 261.99802,+ 267.39542,+ 5.465746e-5,+ 117.1732,+ 270.97543,+ 215.81006,+ 267.98938,+ 19.971058,+ 270.88058,+ 412.71216,+ 272.04578,+ 0.98279095,+ 15.342813,+ 612.47986,+ 275.84296,+ 68.28346,+ 278.4346,+ 275.69434,+ 0.0,+ 269.07025,+ 279.15207,+ 366.9743,+ 420.3035,+ 19.987143,+ 277.62827,+ 566.3287,+ 278.4338,+ 0.98281527,+ 15.546528,+ 122.67509,+ 284.5819,+ 220.98315,+ 287.3899,+ 283.3866,+ 4.7683716e-7,+ 420.9942,+ 284.46536,+ 518.82684,+ 572.64746,+ 19.983475,+ 292.4046,+ 75.89687,+ 295.66296,+ 0.9827324,+ 15.698427,+ 274.09375,+ 292.50607,+ 371.94275,+ 293.77353,+ 291.30078,+ 7.1525574e-7,+ 573.4835,+ 294.57874,+ 29.31255,+ 84.14029,+ 19.974056,+ 299.07965,+ 228.87868,+ 302.53186,+ 0.9828094,+ 15.736185,+ 426.15134,+ 298.59338,+ 525.3641,+ 303.20935,+ 300.1631,+ 2.5868416e-5,+ 83.2912,+ 311.01456,+ 183.5937,+ 236.74663,+ 19.929192,+ 309.35342,+ 380.97076,+ 311.40714,+ 0.9828079,+ 14.6195345,+ 581.23834,+ 307.62936,+ 35.629448,+ 320.05893,+ 314.7911,+ 0.0,+ 238.68806,+ 318.364,+ 336.35117,+ 388.77792,+ 19.976608,+ 316.51434,+ 535.4627,+ 318.72784,+ 0.98271286,+ 15.441138,+ 90.16908,+ 324.48227,+ 187.28825,+ 328.31915,+ 324.56808,+ 0.0,+ 388.76404,+ 326.24783,+ 487.20218,+ 541.3761,+ 19.993996,+ 323.0813,+ 43.72675,+ 334.63513,+ 0.98278004,+ 15.508141,+ 242.42583,+ 332.7289,+ 341.2494,+ 336.64774,+ 331.87866,+ 5.364418e-7,+ 542.502,+ 333.1156,+ 637.8465,+ 52.059147,+ 19.99654,+ 340.90082,+ 195.20418,+ 343.21033,+ 0.98277533,+ 15.755379,+ 394.08524,+ 339.6584,+ 493.77472,+ 342.82205,+ 339.1702,+ 2.0623207e-5,+ 52.696262,+ 350.51895,+ 150.59525,+ 204.90163,+ 19.906996,+ 349.50952,+ 349.84616,+ 351.378,+ 0.982798,+ 15.521656,+ 549.9159,+ 347.8823,+ 5.6788917,+ 358.34756,+ 355.1106,+ 8.940697e-8,+ 207.54999,+ 358.8531,+ 304.4129,+ 356.48715,+ 19.985106,+ 356.02994,+ 501.8174,+ 358.67007,+ 0.98275185,+ 14.683821,+ 58.956024,+ 364.87198,+ 154.44437,+ 368.12848,+ 363.53265,+ 1.4901161e-7,+ 358.22644,+ 366.42578,+ 453.59845,+ 508.49515,+ 19.992376,+ 364.10107,+ 12.098251,+ 374.62158,+ 0.9827858,+ 15.177329,+ 211.37854,+ 372.02753,+ 307.3159,+ 375.26788,+ 371.55103,+ 1.7881393e-7,+ 511.16382,+ 374.20273,+ 606.57196,+ 20.070572,+ 19.996387,+ 380.77173,+ 163.45818,+ 384.44864,+ 0.98272073,+ 15.581158,+ 363.64478,+ 378.67413,+ 459.6552,+ 382.5332,+ 380.1237,+ 4.1633844e-5,+ 19.145136,+ 389.5286,+ 116.2749,+ 171.96202,+ 19.905916,+ 389.62967,+ 316.10382,+ 393.28546,+ 0.982833,+ 15.4017935,+ 517.24945,+ 387.9254,+ 613.0364,+ 397.57108,+ 395.38135,+ 7.748604e-7,+ 174.42825,+ 397.0917,+ 270.7202,+ 325.3144,+ 19.962687,+ 396.59833,+ 470.96017,+ 398.5007,+ 0.98275626,+ 15.159044,+ 28.19255,+ 404.41934,+ 122.518234,+ 408.291,+ 403.66934,+ 1.4901161e-7,+ 325.52762,+ 407.26813,+ 422.93137,+ 476.65634,+ 19.980028,+ 403.7779,+ 620.4766,+ 415.35132,+ 0.98275644,+ 15.708735,+ 177.90048,+ 413.2576,+ 276.66733,+ 415.9431,+ 411.2636,+ 0.0,+ 480.07635,+ 414.05194,+ 573.0298,+ 627.4407,+ 19.992624,+ 420.73468,+ 131.9753,+ 424.7616,+ 0.9827318,+ 15.6849785,+ 330.96265,+ 419.86316,+ 426.80423,+ 423.42883,+ 419.70862,+ 1.9490719e-5,+ 630.0287,+ 429.71823,+ 84.15962,+ 139.84052,+ 19.746002,+ 429.1369,+ 286.43213,+ 432.18918,+ 0.9828061,+ 15.570366,+ 484.31458,+ 427.64578,+ 581.6582,+ 431.14377,+ 434.76727,+ 2.6255846e-5,+ 140.11314,+ 438.68634,+ 240.08043,+ 293.24426,+ 19.981298,+ 437.94196,+ 436.07883,+ 440.62967,+ 0.98276544,+ 15.257694,+ 636.84015,+ 444.55917,+ 90.83606,+ 445.81842,+ 444.31125,+ 2.9802322e-8,+ 295.11777,+ 446.7333,+ 389.76974,+ 444.96875,+ 19.987333,+ 444.87717,+ 590.43695,+ 447.14703,+ 0.982792,+ 15.496889,+ 146.43153,+ 452.1763,+ 245.16267,+ 454.5903,+ 450.89078,+ 2.9802322e-8,+ 446.4031,+ 453.9736,+ 543.72064,+ 596.0058,+ 19.995495,+ 460.6773,+ 98.94853,+ 463.1141,+ 0.9827122,+ 15.662338,+ 297.859,+ 459.55673,+ 395.6896,+ 462.46033,+ 459.6002,+ 1.3411045e-6,+ 597.1999,+ 468.9585,+ 52.028988,+ 107.82169,+ 19.97046,+ 467.79242,+ 253.05594,+ 471.05872,+ 0.98280466,+ 15.74233,+ 450.57242,+ 467.33038,+ 551.1795,+ 471.7013,+ 474.94263,+ 2.9236078e-5,+ 108.17745,+ 478.68234,+ 207.3647,+ 260.23386,+ 19.916855,+ 476.2213,+ 404.17368,+ 479.73886,+ 0.98280346,+ 15.452463,+ 605.9902,+ 484.24173,+ 58.362534,+ 486.77927,+ 483.47327,+ 5.9604645e-8,+ 261.6075,+ 487.3006,+ 359.57852,+ 412.40457,+ 19.881796,+ 485.94162,+ 562.8693,+ 490.2602,+ 0.98274577,+ 15.624087,+ 114.287415,+ 491.6065,+ 212.07779,+ 494.97333,+ 493.50632,+ 0.0,+ 414.69397,+ 495.59473,+ 513.1704,+ 565.97015,+ 19.978376,+ 500.03888,+ 67.6177,+ 503.33362,+ 0.98269904,+ 15.284074,+ 267.3582,+ 501.1051,+ 364.1258,+ 504.06384,+ 499.96332,+ 1.4901161e-7,+ 568.1731,+ 503.16028,+ 21.187782,+ 75.40403,+ 19.981709,+ 511.5686,+ 221.98508,+ 513.5331,+ 0.9827865,+ 15.526731,+ 419.32986,+ 509.094,+ 519.82074,+ 512.2648,+ 508.0207,+ 1.6570091e-5,+ 75.32414,+ 518.63245,+ 174.72597,+ 228.37581,+ 19.91498,+ 519.88635,+ 372.14716,+ 520.28754,+ 0.98285174,+ 15.712103,+ 572.8974,+ 515.9511,+ 28.490301,+ 527.05273,+ 523.2861,+ 1.4901161e-7,+ 230.28291,+ 527.2643,+ 326.87997,+ 380.5929,+ 19.993893,+ 525.6204,+ 530.50336,+ 527.6336,+ 0.98276246,+ 15.591463,+ 82.73275,+ 533.44,+ 180.04353,+ 536.41174,+ 533.02594,+ 4.172325e-7,+ 381.32376,+ 535.929,+ 477.27023,+ 532.9371,+ 19.994173,+ 531.4325,+ 36.815647,+ 543.50433,+ 0.98281443,+ 15.634312,+ 235.59273,+ 543.22217,+ 331.08508,+ 543.3122,+ 540.2235,+ 6.467104e-6,+ 535.1723,+ 543.44635,+ 630.55896,+ 43.873123,+ 19.988064,+ 551.6417,+ 189.41165,+ 553.12445,+ 0.9828811,+ 15.744819,+ 387.1783,+ 550.6176,+ 484.40802,+ 554.02985,+ 548.5625,+ 0.0001322329,+ 43.805347,+ 558.56635,+ 142.0425,+ 197.0855,+ 19.99357,+ 558.1028,+ 340.6793,+ 560.97253,+ 0.9828269,+ 15.710728,+ 541.94574,+ 558.06305,+ 637.17786,+ 568.05475,+ 563.3824,+ 2.5331974e-6,+ 197.47093,+ 566.7584,+ 293.78003,+ 348.2631,+ 19.99383,+ 567.6512,+ 493.66888,+ 569.70166,+ 0.9827945,+ 13.65802,+ 50.139893,+ 574.1484,+ 148.57462,+ 575.40814,+ 572.07526,+ 9.23872e-7,+ 349.10934,+ 573.49744,+ 447.25714,+ 499.59683,+ 19.92641,+ 572.4674,+ 4.733646,+ 584.6314,+ 0.98285365,+ 15.731848,+ 203.83153,+ 581.57294,+ 300.79785,+ 584.0153,+ 580.53723,+ 5.9604645e-7,+ 502.94113,+ 583.3755,+ 597.0394,+ 11.928631,+ 19.992945,+ 591.2045,+ 157.99716,+ 591.5444,+ 0.98279333,+ 15.754675,+ 355.5497,+ 590.72504,+ 453.1278,+ 593.849,+ 588.9093,+ 0.00013053417,+ 13.219303,+ 601.597,+ 108.501045,+ 164.09491,+ 19.97607,+ 598.87946,+ 309.00958,+ 601.1873,+ 0.9828409,+ 15.727812,+ 508.7227,+ 597.7312,+ 604.55774,+ 606.61475,+ 603.90344,+ 1.2874603e-5,+ 165.37201,+ 605.96027,+ 262.48114,+ 316.30234,+ 19.982698,+ 604.1944,+ 462.32425,+ 608.0251,+ 0.9828142,+ 14.271651,+ 19.600445,+ 612.6985,+ 116.54613,+ 615.0456,+ 611.9825,+ 1.552701e-5,+ 317.62903,+ 615.1414,+ 413.26218,+ 468.4817,+ 19.926813,+ 613.5089,+ 614.20624,+ 622.0167,+ 0.98284876,+ 14.94522,+ 171.94058,+ 620.42346,+ 267.6402,+ 622.268,+ 618.8925,+ 0.00012117624,+ 469.81372,+ 623.38,+ 565.1538,+ 620.2975,+ 19.925955,+ 629.7198,+ 125.63345,+ 630.87103,+ 0.98274094,+ 14.097011,+ 322.7291,+ 629.38403,+ 419.677,+ 629.9386,+ 629.6804,+ 0.000101298094,+ 621.08673,+ 637.14716,+ 76.72158,+ 132.36943,+ 19.8525,+ 635.7902,+ 276.82428,+ 637.2131,+ 0.9828099,+ 15.41657,+ 475.8565,+ 635.17725,+ 571.6702,+ 637.6421,+ 5.7400103,+ 1.9311905e-5,+ 133.90977,+ 4.2034626,+ 228.83475,+ 284.0014,+ 33.98933,+ 4.023913,+ 428.7028,+ 5.786687,+ 0.98314106,+ 26.86532,+ 628.8738,+ 12.6095295,+ 82.81181,+ 14.741782,+ 12.671372,+ 2.3066998e-5,+ 285.7146,+ 13.711928,+ 382.7576,+ 435.09875,+ 36.16361,+ 10.650658,+ 582.75635,+ 15.192034,+ 0.9830889,+ 24.885828,+ 137.84656,+ 19.19852,+ 235.11797,+ 22.419659,+ 19.815735,+ 1.2516975e-5,+ 436.29382,+ 20.866043,+ 535.8151,+ 587.6441,+ 38.498,+ 28.838476,+ 91.27265,+ 31.058197,+ 0.9830872,+ 19.467756,+ 290.8617,+ 28.672379,+ 386.00485,+ 30.557426,+ 29.549717,+ 2.0861626e-6,+ 593.7722,+ 28.471395,+ 44.35396,+ 99.62981,+ 38.95168,+ 36.3684,+ 243.58458,+ 38.622387,+ 0.9831057,+ 24.425816,+ 439.9056,+ 34.244102,+ 539.28894,+ 40.20591,+ 42.87324,+ 6.9886446e-5,+ 100.12735,+ 46.022545,+ 195.82489,+ 251.8605,+ 38.823196,+ 44.404354,+ 395.4352,+ 46.37148,+ 0.9831522,+ 27.58576,+ 592.1042,+ 50.193428,+ 50.15724,+ 55.01705,+ 51.695114,+ 3.7431717e-5,+ 253.03542,+ 52.57419,+ 348.42017,+ 403.64233,+ 38.661472,+ 50.86547,+ 548.8471,+ 56.975708,+ 0.98314905,+ 19.765276,+ 105.52928,+ 60.327473,+ 201.78192,+ 62.306347,+ 61.36599,+ 0.000103622675,+ 404.49103,+ 61.651974,+ 501.99466,+ 556.4763,+ 38.820282,+ 66.51435,+ 59.262768,+ 71.210434,+ 0.9830874,+ 20.962927,+ 258.34518,+ 68.2162,+ 354.58688,+ 70.363174,+ 68.590294,+ 1.6540289e-5,+ 556.66254,+ 70.4018,+ 11.858652,+ 68.09907,+ 38.331844,+ 76.84049,+ 210.85568,+ 78.722435,+ 0.98305595,+ 21.977736,+ 409.90875,+ 75.08107,+ 506.62488,+ 79.33794,+ 77.59,+ 0.00012403727,+ 68.35788,+ 85.46371,+ 164.24596,+ 219.86201,+ 38.788967,+ 84.030785,+ 362.16318,+ 86.233444,+ 0.98308504,+ 26.770937,+ 560.1629,+ 83.199036,+ 19.026627,+ 94.02689,+ 91.15882,+ 2.861023e-5,+ 219.29716,+ 94.01845,+ 316.36908,+ 371.95984,+ 39.03785,+ 91.0974,+ 515.0443,+ 95.17586,+ 0.9831206,+ 17.406126,+ 74.302864,+ 98.42031,+ 169.55995,+ 100.33115,+ 98.46078,+ 4.9054623e-5,+ 372.13998,+ 100.93343,+ 468.60553,+ 524.1206,+ 39.094246,+ 100.785614,+ 28.325516,+ 110.11964,+ 0.983099,+ 23.139791,+ 223.90111,+ 106.26644,+ 322.14874,+ 111.44089,+ 108.163666,+ 1.9550323e-5,+ 526.0683,+ 110.378654,+ 620.96466,+ 36.243237,+ 38.88265,+ 115.491455,+ 179.93495,+ 118.25528,+ 0.9831283,+ 22.062029,+ 375.90363,+ 112.47054,+ 474.1679,+ 118.02362,+ 115.864586,+ 0.00014969707,+ 36.520943,+ 125.472496,+ 131.20035,+ 188.53879,+ 39.426434,+ 121.45247,+ 330.8468,+ 127.041626,+ 0.9831644,+ 22.94281,+ 527.96497,+ 122.70445,+ 628.78156,+ 133.47258,+ 131.99281,+ 6.943941e-6,+ 189.00294,+ 132.83435,+ 285.01324,+ 339.63086,+ 38.06952,+ 128.54202,+ 483.62604,+ 134.92065,+ 0.9831097,+ 4.5909057,+ 42.96624,+ 138.53746,+ 141.11646,+ 142.57549,+ 140.81294,+ 8.34465e-7,+ 340.59756,+ 142.62094,+ 438.76428,+ 492.84064,+ 39.52321,+ 139.56375,+ 637.4971,+ 150.45586,+ 0.983099,+ 27.528912,+ 189.7597,+ 143.30399,+ 289.98975,+ 150.66351,+ 146.04947,+ 4.172325e-7,+ 493.60992,+ 148.54236,+ 589.2317,+ 5.729643,+ 38.715355,+ 155.93958,+ 147.04608,+ 160.90349,+ 0.9832126,+ 29.33156,+ 343.21637,+ 151.58083,+ 442.1791,+ 159.39037,+ 155.97621,+ 6.553531e-5,+ 7.4289503,+ 166.68652,+ 100.53762,+ 156.28746,+ 39.294113,+ 158.59735,+ 300.96933,+ 166.80522,+ 0.98325086,+ 27.609121,+ 496.1363,+ 162.18222,+ 595.8099,+ 172.97336,+ 172.12221,+ 6.377697e-6,+ 155.90602,+ 171.69212,+ 254.55688,+ 308.81287,+ 38.572395,+ 168.35925,+ 451.47952,+ 175.12369,+ 0.98313844,+ 16.801437,+ 11.080443,+ 180.28758,+ 106.33783,+ 184.0248,+ 179.34311,+ 3.5762787e-7,+ 310.7162,+ 180.74709,+ 407.4346,+ 461.93658,+ 39.46534,+ 177.85634,+ 607.16455,+ 190.17589,+ 0.9830728,+ 24.514702,+ 158.73726,+ 188.3152,+ 257.81012,+ 192.27815,+ 186.26616,+ 2.0861626e-7,+ 466.03217,+ 188.55669,+ 559.4808,+ 612.3013,+ 38.81124,+ 196.53561,+ 112.295364,+ 199.4422,+ 0.9832051,+ 25.786905,+ 311.87253,+ 193.49614,+ 408.87976,+ 200.91777,+ 195.82838,+ 2.0116568e-5,+ 613.1369,+ 205.72067,+ 67.120964,+ 124.004974,+ 38.97963,+ 202.2268,+ 266.93738,+ 208.93375,+ 0.9832654,+ 26.745005,+ 464.82803,+ 198.79816,+ 564.55164,+ 207.40707,+ 211.44891,+ 7.888675e-5,+ 123.39945,+ 213.03828,+ 223.7651,+ 275.1146,+ 37.689777,+ 211.21414,+ 419.8183,+ 216.73499,+ 0.98316437,+ 17.80609,+ 619.0618,+ 219.43161,+ 74.485916,+ 223.39555,+ 220.18832,+ 2.3841858e-7,+ 277.82077,+ 222.5383,+ 373.74203,+ 428.8267,+ 38.266415,+ 217.70091,+ 573.7523,+ 224.38968,+ 0.9831031,+ 18.793982,+ 126.904175,+ 226.24655,+ 226.77515,+ 230.7807,+ 229.04646,+ 5.066395e-7,+ 431.41418,+ 230.20955,+ 527.7229,+ 581.1904,+ 39.09531,+ 237.13092,+ 82.72769,+ 239.02435,+ 0.98326147,+ 28.36579,+ 279.73264,+ 236.1018,+ 375.86597,+ 240.58739,+ 236.22772,+ 1.3709068e-6,+ 582.59717,+ 238.56082,+ 35.929043,+ 91.72206,+ 38.78952,+ 243.33415,+ 236.37744,+ 248.82368,+ 0.98319745,+ 26.43198,+ 432.68973,+ 243.18878,+ 532.7401,+ 246.35767,+ 243.44977,+ 0.00015294552,+ 91.20099,+ 254.14261,+ 190.90369,+ 244.14543,+ 37.607265,+ 251.64798,+ 388.30197,+ 256.58032,+ 0.98314714,+ 24.449524,+ 588.3188,+ 249.79349,+ 43.1294,+ 262.55127,+ 259.59705,+ 3.5762787e-7,+ 247.8097,+ 262.6274,+ 343.6822,+ 396.8084,+ 38.74578,+ 257.82837,+ 544.56287,+ 263.83157,+ 0.98310924,+ 18.908758,+ 97.19039,+ 266.71365,+ 193.8327,+ 274.3586,+ 267.50092,+ 3.5762787e-7,+ 397.3672,+ 270.76352,+ 495.61685,+ 548.5732,+ 39.146683,+ 274.71042,+ 50.755615,+ 278.20435,+ 0.9832181,+ 29.430244,+ 246.74452,+ 275.77594,+ 349.03577,+ 279.2267,+ 276.597,+ 4.23193e-6,+ 551.37933,+ 276.89102,+ 6.4180803,+ 59.95995,+ 39.221478,+ 283.55045,+ 205.12831,+ 288.35126,+ 0.98323476,+ 25.077381,+ 400.4606,+ 280.9753,+ 498.4563,+ 286.70004,+ 283.64023,+ 0.00013017654,+ 58.98314,+ 294.17337,+ 155.91537,+ 212.09016,+ 37.88363,+ 291.17618,+ 356.85757,+ 294.04263,+ 0.9832088,+ 22.225613,+ 555.4204,+ 290.98688,+ 11.338203,+ 301.6281,+ 299.82513,+ 3.874302e-7,+ 216.64053,+ 302.4694,+ 309.69467,+ 364.34735,+ 37.81758,+ 300.57373,+ 509.1889,+ 302.2268,+ 0.9831177,+ 18.97818,+ 66.00731,+ 306.2712,+ 158.78209,+ 311.6538,+ 308.10132,+ 1.7881393e-7,+ 364.37686,+ 310.8967,+ 461.16898,+ 517.58203,+ 39.21317,+ 308.64825,+ 19.296137,+ 319.48004,+ 0.98311186,+ 25.061079,+ 216.06099,+ 316.88474,+ 313.61008,+ 318.05536,+ 315.09436,+ 1.4603138e-6,+ 519.9138,+ 316.86212,+ 613.45996,+ 28.068981,+ 38.96847,+ 322.2683,+ 172.16745,+ 327.86243,+ 0.9832501,+ 28.611746,+ 367.76843,+ 322.89835,+ 467.38727,+ 326.35928,+ 322.60703,+ 0.00032651424,+ 27.775064,+ 333.68558,+ 123.55406,+ 179.6355,+ 37.41489,+ 331.8144,+ 324.06424,+ 338.09155,+ 0.98315495,+ 27.221025,+ 521.934,+ 330.51456,+ 619.792,+ 342.5269,+ 338.36554,+ 1.1920929e-6,+ 183.22594,+ 341.63538,+ 279.79688,+ 332.6157,+ 39.287178,+ 338.68738,+ 476.2051,+ 343.05234,+ 0.9831027,+ 13.311213,+ 35.396248,+ 347.96735,+ 130.577,+ 349.73618,+ 347.23184,+ 2.3841858e-7,+ 335.17087,+ 352.3485,+ 431.44574,+ 484.2359,+ 39.52262,+ 347.4433,+ 629.12726,+ 358.97003,+ 0.9830724,+ 24.811588,+ 183.20616,+ 356.19656,+ 282.91586,+ 360.73755,+ 356.7155,+ 1.0430813e-6,+ 486.05316,+ 356.61786,+ 583.79895,+ 635.48645,+ 38.42602,+ 365.28763,+ 137.49503,+ 367.47888,+ 0.9832615,+ 28.213274,+ 336.48962,+ 361.2969,+ 434.12183,+ 365.04214,+ 363.73676,+ 2.4914742e-5,+ 638.4195,+ 373.9839,+ 91.52592,+ 147.51717,+ 36.562454,+ 370.9622,+ 293.72394,+ 377.4445,+ 0.9831935,+ 23.677937,+ 489.29266,+ 369.23526,+ 589.29675,+ 375.00055,+ 379.27277,+ 6.93202e-5,+ 149.95778,+ 381.89127,+ 245.89868,+ 301.8916,+ 39.241493,+ 377.92957,+ 442.8434,+ 384.08722,+ 0.9831444,+ 14.95269,+ 4.076283,+ 388.9308,+ 98.729485,+ 391.18185,+ 387.68,+ 1.4901161e-7,+ 303.67258,+ 391.1577,+ 398.4096,+ 452.64816,+ 38.88362,+ 387.15942,+ 598.6114,+ 398.78033,+ 0.98307073,+ 14.506787,+ 149.95439,+ 391.893,+ 250.01508,+ 398.09708,+ 395.87888,+ 2.0861626e-7,+ 453.53796,+ 397.0176,+ 552.6856,+ 604.1239,+ 39.043953,+ 405.47375,+ 107.65556,+ 407.30148,+ 0.98326445,+ 27.22602,+ 303.2451,+ 403.46252,+ 400.9218,+ 407.814,+ 404.7143,+ 1.4960766e-5,+ 605.3566,+ 412.5001,+ 59.164818,+ 116.20156,+ 36.392204,+ 411.5217,+ 260.507,+ 416.8852,+ 0.9832,+ 29.274359,+ 455.91772,+ 409.5724,+ 556.59973,+ 415.46973,+ 419.7092,+ 0.000166744,+ 114.98749,+ 422.35025,+ 214.77826,+ 269.10037,+ 39.28835,+ 416.47574,+ 411.2442,+ 424.07526,+ 0.98317325,+ 17.65796,+ 613.00995,+ 427.15155,+ 66.90638,+ 430.87186,+ 429.31104,+ 4.172325e-7,+ 272.26727,+ 430.6646,+ 365.25516,+ 420.30585,+ 38.38813,+ 424.23163,+ 566.4879,+ 431.01364,+ 0.98307246,+ 17.690744,+ 119.84245,+ 434.68842,+ 217.25285,+ 439.2682,+ 436.75293,+ 5.9604645e-7,+ 423.56177,+ 439.10492,+ 520.86475,+ 572.57043,+ 38.799194,+ 444.55414,+ 75.205055,+ 446.91437,+ 0.983262,+ 27.976263,+ 273.46704,+ 443.6326,+ 370.22525,+ 448.13306,+ 445.56027,+ 1.013279e-6,+ 575.13605,+ 447.67078,+ 27.01439,+ 83.90509,+ 38.488213,+ 451.69174,+ 227.78387,+ 457.1584,+ 0.98322505,+ 25.645535,+ 423.00833,+ 450.17578,+ 526.21277,+ 455.00244,+ 451.0234,+ 0.00013270974,+ 84.44236,+ 461.29575,+ 182.9295,+ 236.47708,+ 38.650673,+ 457.83286,+ 379.053,+ 463.3704,+ 0.9832878,+ 22.467693,+ 581.2197,+ 459.14813,+ 35.041744,+ 469.1055,+ 467.90063,+ 1.4901161e-7,+ 238.50258,+ 470.0577,+ 335.17175,+ 388.41107,+ 38.524643,+ 466.3335,+ 534.89185,+ 472.1252,+ 0.9831346,+ 18.93556,+ 88.44543,+ 474.84888,+ 185.1854,+ 475.99542,+ 475.96338,+ 1.4901161e-7,+ 389.02237,+ 477.70322,+ 488.00888,+ 541.3594,+ 39.405037,+ 474.06158,+ 42.479008,+ 487.6924,+ 0.9832269,+ 27.134804,+ 241.13524,+ 481.3019,+ 337.3786,+ 486.1272,+ 483.64612,+ 7.1525574e-7,+ 544.7372,+ 487.1511,+ 638.3696,+ 52.125713,+ 39.02806,+ 490.3117,+ 195.25887,+ 493.77924,+ 0.9832504,+ 27.213926,+ 392.51917,+ 492.7467,+ 491.0906,+ 497.81073,+ 492.85837,+ 0.00011584163,+ 51.73182,+ 502.79974,+ 149.53925,+ 204.09912,+ 37.868317,+ 500.44843,+ 349.69894,+ 503.77454,+ 0.98322743,+ 25.740122,+ 549.90967,+ 499.2158,+ 3.771669,+ 511.2044,+ 507.35736,+ 6.2584877e-7,+ 207.94833,+ 512.4545,+ 302.7658,+ 356.5966,+ 38.419132,+ 511.91718,+ 501.29257,+ 514.26855,+ 0.98311394,+ 12.257396,+ 57.982,+ 517.0641,+ 153.5761,+ 520.4123,+ 518.0463,+ 2.0861626e-7,+ 358.6789,+ 519.9755,+ 454.27017,+ 509.0301,+ 38.55207,+ 517.7651,+ 11.643923,+ 527.963,+ 0.98308384,+ 25.179512,+ 210.31729,+ 525.4758,+ 307.0857,+ 526.4357,+ 524.3863,+ 6.467104e-6,+ 512.1413,+ 526.62115,+ 606.56915,+ 20.329433,+ 38.617317,+ 534.6011,+ 164.8638,+ 537.76355,+ 0.9831576,+ 25.155956,+ 362.21112,+ 533.79565,+ 460.96344,+ 536.0101,+ 533.6644,+ 0.000102072954,+ 19.825079,+ 543.6389,+ 116.4471,+ 172.21852,+ 38.920715,+ 541.3657,+ 316.53793,+ 544.9964,+ 0.9831196,+ 23.346285,+ 516.4028,+ 540.4521,+ 612.1906,+ 550.33844,+ 548.09406,+ 1.1175871e-5,+ 172.54008,+ 551.7165,+ 271.41263,+ 323.98337,+ 38.315372,+ 550.30585,+ 469.5114,+ 554.573,+ 0.98310447,+ 17.948715,+ 26.40858,+ 556.7882,+ 121.8272,+ 561.18634,+ 556.9881,+ 2.861023e-6,+ 325.67514,+ 559.77795,+ 421.9853,+ 476.76428,+ 38.18596,+ 556.49493,+ 621.116,+ 567.4533,+ 0.9830808,+ 23.532349,+ 177.21748,+ 566.2406,+ 275.16354,+ 567.5439,+ 564.74396,+ 7.122755e-6,+ 476.60135,+ 567.7677,+ 575.51416,+ 627.4159,+ 38.90401,+ 574.8005,+ 132.45818,+ 575.7608,+ 0.9830619,+ 24.567163,+ 329.7798,+ 572.7198,+ 427.58243,+ 576.49036,+ 573.6208,+ 0.00013265014,+ 629.50543,+ 582.9478,+ 85.2991,+ 139.80681,+ 38.81257,+ 581.9297,+ 284.95316,+ 585.2224,+ 0.9831307,+ 24.172398,+ 479.9323,+ 580.9227,+ 580.19,+ 582.72144,+ 587.7925,+ 2.1964312e-5,+ 142.44444,+ 590.5287,+ 237.53633,+ 292.5608,+ 38.158203,+ 589.3814,+ 438.31345,+ 593.4385,+ 0.98313236,+ 18.853415,+ 636.9496,+ 597.9541,+ 90.48027,+ 601.6686,+ 597.13477,+ 2.4199486e-5,+ 294.67264,+ 600.0225,+ 388.5278,+ 443.77896,+ 38.12969,+ 599.0581,+ 590.1857,+ 598.7657,+ 0.98311615,+ 17.654118,+ 146.71304,+ 604.051,+ 245.131,+ 606.593,+ 604.2391,+ 1.9103289e-5,+ 446.3571,+ 607.53467,+ 542.18835,+ 596.46625,+ 37.24365,+ 615.5322,+ 101.166824,+ 612.0058,+ 0.9830862,+ 20.90191,+ 299.35486,+ 614.7097,+ 395.01453,+ 614.5012,+ 612.8558,+ 0.00014013052,+ 596.53784,+ 620.9806,+ 53.435734,+ 108.12209,+ 38.337788,+ 620.9202,+ 254.0501,+ 622.3658,+ 0.9830749,+ 18.086082,+ 450.4725,+ 622.4683,+ 547.51483,+ 622.3247,+ 627.88574,+ 0.000113368034,+ 109.824936,+ 630.1819,+ 205.81796,+ 260.24664,+ 34.730804,+ 628.00867,+ 405.9891,+ 629.1573,+ 0.9830452,+ 19.28039,+ 603.5505,+ 634.1357,+ 58.621437,+ 635.73047,+ 634.87994,+ 6.762147e-5,+ 261.96967,+ 635.48474,+ 357.6439,+ 412.20648,+ 30.533724,+ 634.7947,+ 557.8275,+ 636.8075,+ 0.98472196,+ 28.65205,+ 113.74058,+ 3.5133626,+ 208.99588,+ 5.2310333,+ 6.4772034,+ 2.1189451e-5,+ 414.2241,+ 5.22737,+ 509.40155,+ 565.42914,+ 29.941011,+ 12.9262905,+ 67.38092,+ 15.661275,+ 0.9846517,+ 28.83645,+ 267.7331,+ 13.563913,+ 360.25565,+ 14.97468,+ 13.995782,+ 3.516674e-6,+ 568.4655,+ 15.537055,+ 19.971199,+ 75.34961,+ 42.93543,+ 21.37614,+ 219.4733,+ 22.665981,+ 0.9846753,+ 28.75354,+ 416.5512,+ 19.025656,+ 512.89233,+ 25.971626,+ 21.918892,+ 5.5223703e-5,+ 78.124146,+ 30.927176,+ 171.67352,+ 228.49574,+ 39.898506,+ 30.172844,+ 370.19534,+ 33.39734,+ 0.9846595,+ 39.64503,+ 568.2781,+ 26.251755,+ 26.846748,+ 38.19616,+ 37.06304,+ 8.302927e-5,+ 227.55205,+ 38.61429,+ 324.539,+ 380.61856,+ 45.146446,+ 37.155663,+ 525.28174,+ 42.41648,+ 0.9846101,+ 21.421675,+ 82.39727,+ 43.601486,+ 177.64708,+ 48.267822,+ 44.073975,+ 0.00010919571,+ 380.26505,+ 45.210484,+ 477.22803,+ 532.474,+ 49.62922,+ 41.928833,+ 36.645256,+ 54.486526,+ 0.984668,+ 26.04077,+ 234.29309,+ 52.310944,+ 330.29752,+ 55.681763,+ 52.335396,+ 2.3245811e-5,+ 535.48694,+ 54.046524,+ 631.25854,+ 44.062798,+ 44.804825,+ 61.790386,+ 186.4545,+ 62.263725,+ 0.984665,+ 20.476414,+ 383.49515,+ 61.175606,+ 480.5563,+ 64.395676,+ 60.432373,+ 7.417798e-5,+ 43.479877,+ 71.06172,+ 139.53207,+ 196.09578,+ 43.69434,+ 69.292755,+ 339.08997,+ 71.7283,+ 0.98468155,+ 23.981138,+ 536.3697,+ 68.529564,+ 637.65765,+ 78.89687,+ 77.29012,+ 0.00011482835,+ 195.44307,+ 78.81189,+ 291.6178,+ 347.7811,+ 44.293617,+ 77.02225,+ 489.699,+ 82.16309,+ 0.98465204,+ 10.68262,+ 49.80068,+ 85.1905,+ 146.78497,+ 86.867714,+ 83.57681,+ 0.00012820959,+ 346.62164,+ 86.334114,+ 443.2998,+ 499.21,+ 48.271317,+ 84.04229,+ 4.6878653,+ 95.3273,+ 0.98470354,+ 28.74086,+ 200.27255,+ 90.87837,+ 297.52502,+ 94.31981,+ 92.9982,+ 9.778142e-5,+ 500.83722,+ 94.15433,+ 597.1677,+ 12.257037,+ 42.786724,+ 101.32802,+ 153.6926,+ 103.00626,+ 0.98461616,+ 21.654102,+ 351.77625,+ 98.07553,+ 447.05817,+ 102.88937,+ 99.89586,+ 0.00010031462,+ 10.498354,+ 110.580185,+ 107.79906,+ 164.15451,+ 48.5546,+ 105.724525,+ 305.0112,+ 112.2792,+ 0.9846779,+ 27.433002,+ 501.4685,+ 104.70127,+ 602.3652,+ 119.38289,+ 116.687744,+ 4.094839e-5,+ 163.31125,+ 117.7914,+ 259.415,+ 316.85132,+ 47.799587,+ 113.74234,+ 456.04153,+ 120.85916,+ 0.98460853,+ 16.249262,+ 19.2262,+ 125.663216,+ 113.91836,+ 128.59581,+ 123.601715,+ 1.4454126e-5,+ 315.49503,+ 125.49446,+ 413.47455,+ 467.9292,+ 49.652626,+ 123.40064,+ 612.61646,+ 133.95497,+ 0.9847125,+ 17.779772,+ 163.90068,+ 128.73442,+ 263.5059,+ 135.05913,+ 132.4285,+ 7.688999e-6,+ 466.09607,+ 133.22522,+ 564.5381,+ 619.4599,+ 47.198326,+ 139.99237,+ 121.58215,+ 146.4621,+ 0.9846271,+ 29.719667,+ 314.849,+ 138.80785,+ 415.42654,+ 145.66719,+ 140.98228,+ 2.3335218e-5,+ 622.51514,+ 150.07053,+ 76.31451,+ 131.41663,+ 52.845684,+ 144.77126,+ 271.54504,+ 154.34251,+ 0.98460495,+ 37.62797,+ 466.5553,+ 142.72253,+ 570.8531,+ 152.05676,+ 156.31354,+ 4.87864e-5,+ 131.61443,+ 157.13939,+ 231.74196,+ 283.76727,+ 52.33396,+ 150.7099,+ 424.83215,+ 162.69931,+ 0.984506,+ 24.897835,+ 627.42084,+ 165.02179,+ 82.095,+ 168.01027,+ 163.48645,+ 8.34465e-7,+ 286.43402,+ 164.76324,+ 383.25992,+ 436.18286,+ 52.10899,+ 161.11816,+ 582.4366,+ 168.81844,+ 0.98470837,+ 26.119822,+ 133.49126,+ 168.68085,+ 231.1331,+ 174.98749,+ 170.69743,+ 3.2782555e-7,+ 438.9744,+ 173.73024,+ 534.68835,+ 588.20776,+ 45.407364,+ 182.12451,+ 88.11767,+ 186.4119,+ 0.9845973,+ 37.60596,+ 287.5666,+ 176.49605,+ 383.6257,+ 184.0736,+ 180.8006,+ 8.285046e-6,+ 590.60596,+ 181.57303,+ 43.734863,+ 99.97633,+ 48.967583,+ 187.624,+ 241.17021,+ 193.58089,+ 0.98450184,+ 37.907303,+ 436.8168,+ 181.71922,+ 538.7846,+ 191.27823,+ 196.01349,+ 0.00013393164,+ 97.776375,+ 198.72453,+ 198.60442,+ 252.78331,+ 44.233353,+ 193.08185,+ 395.4973,+ 201.66148,+ 0.9845555,+ 24.107618,+ 595.6275,+ 203.07866,+ 49.58147,+ 208.13634,+ 205.08476,+ 5.066395e-7,+ 253.59508,+ 207.28197,+ 349.65604,+ 404.33514,+ 38.27307,+ 203.06929,+ 551.05493,+ 208.08672,+ 0.9846274,+ 24.493101,+ 103.11106,+ 210.8978,+ 199.39688,+ 218.26553,+ 213.96141,+ 1.1026859e-6,+ 407.8634,+ 216.76492,+ 502.6972,+ 555.963,+ 34.215324,+ 219.85883,+ 57.264557,+ 225.06172,+ 0.9846262,+ 38.832626,+ 254.27718,+ 219.92651,+ 352.81726,+ 225.42552,+ 221.43823,+ 3.0994415e-6,+ 558.8705,+ 221.36804,+ 11.317004,+ 68.07141,+ 48.668705,+ 228.12393,+ 212.28888,+ 232.02455,+ 0.9846053,+ 38.20017,+ 408.82428,+ 229.46336,+ 506.76572,+ 232.62312,+ 228.93976,+ 0.00015121698,+ 66.79615,+ 237.7627,+ 164.77026,+ 220.75882,+ 47.189278,+ 234.66156,+ 363.2053,+ 241.21153,+ 0.9846575,+ 33.111927,+ 563.5253,+ 236.84232,+ 18.969961,+ 247.33687,+ 245.22394,+ 7.4505806e-7,+ 225.94608,+ 244.86801,+ 320.27023,+ 371.76068,+ 44.74666,+ 243.22798,+ 516.4664,+ 248.43523,+ 0.98474896,+ 16.750147,+ 74.75759,+ 250.36057,+ 167.48355,+ 256.85797,+ 251.62056,+ 8.6426735e-7,+ 375.38544,+ 256.3256,+ 471.48734,+ 524.135,+ 49.006264,+ 252.894,+ 26.870275,+ 262.55228,+ 0.9846462,+ 31.637314,+ 223.25891,+ 259.73825,+ 321.6857,+ 265.69574,+ 261.83206,+ 4.172325e-6,+ 526.5817,+ 262.4866,+ 620.8225,+ 36.32356,+ 41.758984,+ 265.6149,+ 178.67676,+ 273.80865,+ 0.98458385,+ 35.452652,+ 374.10687,+ 266.15625,+ 473.86157,+ 272.10333,+ 267.59695,+ 0.00012469292,+ 35.720543,+ 278.82007,+ 133.81046,+ 188.31078,+ 44.096,+ 277.4405,+ 330.74277,+ 282.72687,+ 0.98463607,+ 33.377834,+ 529.7936,+ 276.26245,+ 628.1094,+ 285.82593,+ 284.19293,+ 1.4901161e-6,+ 191.22725,+ 285.54535,+ 285.30478,+ 340.39005,+ 45.61731,+ 283.55692,+ 481.817,+ 288.35574,+ 0.9846796,+ 7.4231844,+ 42.394794,+ 292.17572,+ 136.91061,+ 296.1637,+ 291.23788,+ 7.1525574e-7,+ 342.3943,+ 293.49033,+ 438.83875,+ 491.785,+ 53.44427,+ 291.8904,+ 637.38727,+ 302.9481,+ 0.9846842,+ 37.79664,+ 188.2422,+ 299.41318,+ 286.16318,+ 303.96628,+ 301.15775,+ 2.6226044e-6,+ 492.86685,+ 301.89264,+ 589.35114,+ 5.6930637,+ 44.05312,+ 309.1773,+ 145.68517,+ 310.13428,+ 0.9845704,+ 36.328857,+ 343.08994,+ 309.1773,+ 441.19296,+ 312.8975,+ 308.95862,+ 7.95424e-5,+ 4.28032,+ 319.5279,+ 99.34532,+ 153.48143,+ 42.248016,+ 315.74664,+ 298.9604,+ 321.3119,+ 0.98465466,+ 31.065731,+ 495.70953,+ 315.39224,+ 595.95685,+ 327.49448,+ 324.618,+ 1.3947487e-5,+ 155.7118,+ 326.86966,+ 257.38428,+ 308.25742,+ 51.957035,+ 323.30753,+ 449.0617,+ 328.87274,+ 0.9846443,+ 17.631765,+ 9.28956,+ 332.96307,+ 104.92407,+ 337.32626,+ 331.63928,+ 6.2584877e-7,+ 312.02374,+ 336.95752,+ 405.6533,+ 460.65237,+ 45.29428,+ 330.1244,+ 605.9568,+ 343.05457,+ 0.9847001,+ 26.316618,+ 157.17325,+ 338.13016,+ 256.70413,+ 346.0714,+ 341.2189,+ 4.917383e-6,+ 460.6019,+ 341.97812,+ 559.02704,+ 611.3756,+ 47.30946,+ 349.31052,+ 112.950584,+ 349.70316,+ 0.98452747,+ 37.083652,+ 309.68265,+ 347.0423,+ 408.89578,+ 351.42044,+ 347.57535,+ 3.2514334e-5,+ 612.23627,+ 358.23907,+ 66.9504,+ 122.82255,+ 38.92809,+ 356.30368,+ 266.5281,+ 361.98212,+ 0.9845921,+ 31.918808,+ 463.37137,+ 353.4128,+ 564.7301,+ 360.15424,+ 364.21826,+ 0.00010865927,+ 123.546646,+ 365.67407,+ 223.122,+ 275.7065,+ 52.38225,+ 362.62115,+ 417.89575,+ 369.20673,+ 0.98454595,+ 25.192245,+ 619.40173,+ 371.99454,+ 74.45193,+ 376.65356,+ 372.30243,+ 5.364418e-7,+ 279.58835,+ 376.8974,+ 374.33435,+ 427.62402,+ 49.900272,+ 369.40466,+ 575.14154,+ 376.56805,+ 0.984709,+ 21.518501,+ 124.99441,+ 379.89957,+ 224.63509,+ 386.31558,+ 382.17206,+ 1.5795231e-6,+ 429.6711,+ 381.8758,+ 527.14233,+ 580.6757,+ 40.84165,+ 390.21518,+ 83.08982,+ 392.4222,+ 0.9845197,+ 34.628796,+ 280.4534,+ 386.6519,+ 375.52225,+ 392.55685,+ 388.93362,+ 3.3676624e-6,+ 582.61816,+ 390.24954,+ 34.485043,+ 92.07828,+ 47.95879,+ 390.41446,+ 236.52657,+ 400.2204,+ 0.9845531,+ 36.602684,+ 429.50568,+ 393.62216,+ 533.81335,+ 399.61093,+ 396.4976,+ 0.00013917685,+ 91.49245,+ 406.42365,+ 190.22726,+ 244.30997,+ 47.589836,+ 402.5194,+ 384.77972,+ 407.22104,+ 0.9845921,+ 31.364231,+ 588.83325,+ 402.94827,+ 42.822357,+ 415.41974,+ 413.36172,+ 9.23872e-7,+ 247.6802,+ 416.70557,+ 343.61313,+ 396.1303,+ 47.041023,+ 409.5735,+ 544.2919,+ 414.9112,+ 0.98472196,+ 19.591677,+ 97.46928,+ 418.7748,+ 192.11131,+ 424.52045,+ 422.5746,+ 1.4007092e-6,+ 398.74487,+ 422.9899,+ 497.41443,+ 548.6781,+ 44.099697,+ 427.53625,+ 49.95508,+ 431.0488,+ 0.9846563,+ 37.19602,+ 247.78548,+ 428.02997,+ 345.20053,+ 432.80844,+ 428.96582,+ 6.2584877e-7,+ 549.85114,+ 430.46625,+ 6.5566416,+ 59.89136,+ 45.191696,+ 434.76654,+ 204.21664,+ 442.14377,+ 0.9846051,+ 34.279236,+ 399.2764,+ 435.36755,+ 496.28836,+ 439.142,+ 435.50015,+ 0.00012248755,+ 60.254074,+ 446.48123,+ 158.0215,+ 212.53796,+ 46.94311,+ 444.52512,+ 353.7446,+ 449.90433,+ 0.9845698,+ 34.620888,+ 555.1281,+ 444.49603,+ 10.872854,+ 454.5939,+ 452.08044,+ 1.1026859e-6,+ 216.7753,+ 455.79407,+ 309.458,+ 364.14517,+ 48.82585,+ 451.2691,+ 508.56436,+ 456.54092,+ 0.9847038,+ 20.753588,+ 67.01495,+ 458.397,+ 158.68709,+ 464.83426,+ 461.8196,+ 3.874302e-7,+ 366.58682,+ 462.82718,+ 465.48798,+ 517.6046,+ 50.40203,+ 460.5351,+ 19.450483,+ 471.0556,+ 0.98466945,+ 35.90775,+ 213.11423,+ 466.89294,+ 312.58142,+ 472.95728,+ 469.48236,+ 2.9802322e-7,+ 520.51166,+ 470.1094,+ 613.60815,+ 27.88129,+ 45.091843,+ 477.0614,+ 170.5323,+ 477.78708,+ 0.98460156,+ 37.502663,+ 365.81888,+ 473.74957,+ 466.0664,+ 483.06454,+ 476.9977,+ 4.0084124e-5,+ 28.924221,+ 486.8122,+ 123.65355,+ 178.94173,+ 42.22259,+ 480.78433,+ 324.24832,+ 489.06915,+ 0.98463595,+ 41.555054,+ 519.0908,+ 483.00018,+ 618.586,+ 493.73166,+ 493.39612,+ 4.4703484e-6,+ 183.50716,+ 492.01697,+ 279.08008,+ 333.07047,+ 47.306915,+ 491.75714,+ 476.80927,+ 500.01373,+ 0.9846136,+ 15.197921,+ 33.96752,+ 500.971,+ 129.08113,+ 501.4473,+ 501.03122,+ 5.364418e-7,+ 336.06058,+ 504.1043,+ 430.49878,+ 483.32773,+ 51.345875,+ 498.51523,+ 629.56635,+ 513.01843,+ 0.9846502,+ 24.120197,+ 183.45505,+ 510.60278,+ 281.84775,+ 513.6421,+ 509.07718,+ 1.847744e-6,+ 488.8212,+ 510.7836,+ 582.9694,+ 634.79065,+ 44.210865,+ 517.5425,+ 136.19344,+ 521.2841,+ 0.98461354,+ 36.621536,+ 335.71378,+ 519.18445,+ 432.48117,+ 521.91626,+ 517.9497,+ 8.0525875e-5,+ 637.63513,+ 528.48956,+ 91.42197,+ 146.99033,+ 33.67639,+ 525.69666,+ 293.79364,+ 528.0274,+ 0.9846593,+ 31.312662,+ 486.6934,+ 524.543,+ 588.10175,+ 527.7876,+ 533.2181,+ 4.285574e-5,+ 147.88644,+ 537.7588,+ 245.49316,+ 301.08142,+ 45.610123,+ 534.41254,+ 443.2362,+ 538.03314,+ 0.98460186,+ 22.654873,+ 6.127679,+ 541.21704,+ 97.442085,+ 545.8393,+ 542.87634,+ 4.6491623e-6,+ 303.16977,+ 544.8498,+ 397.5658,+ 452.1836,+ 43.60337,+ 542.6121,+ 597.86224,+ 550.59033,+ 0.9846925,+ 26.38443,+ 152.18546,+ 551.5085,+ 250.87784,+ 553.574,+ 549.81116,+ 2.5570393e-5,+ 453.5777,+ 551.1917,+ 552.11664,+ 604.3442,+ 44.19826,+ 557.30896,+ 105.960175,+ 562.18414,+ 0.984681,+ 30.799671,+ 306.21667,+ 558.0896,+ 401.1575,+ 562.6108,+ 558.8509,+ 3.3169985e-5,+ 605.8277,+ 566.6711,+ 58.758522,+ 116.50245,+ 40.52703,+ 566.859,+ 260.94363,+ 569.8487,+ 0.9846537,+ 27.703512,+ 455.4613,+ 564.92676,+ 555.70844,+ 567.9304,+ 572.4304,+ 0.000103354454,+ 118.47145,+ 573.77795,+ 212.66632,+ 268.73148,+ 41.359028,+ 573.99457,+ 411.7971,+ 577.95667,+ 0.9846643,+ 22.856047,+ 612.6663,+ 580.21466,+ 66.406815,+ 585.6924,+ 582.35675,+ 7.0512295e-5,+ 269.99698,+ 586.5329,+ 365.83,+ 419.95566,+ 45.55059,+ 584.4415,+ 566.3171,+ 583.3805,+ 0.9846652,+ 29.551394,+ 121.2986,+ 590.1975,+ 219.84074,+ 592.7004,+ 589.7491,+ 1.6212463e-5,+ 423.88953,+ 591.8412,+ 522.5037,+ 573.80664,+ 37.71137,+ 596.40125,+ 74.590675,+ 602.9077,+ 0.98467386,+ 25.426867,+ 273.3007,+ 598.5494,+ 368.28696,+ 603.4242,+ 598.9586,+ 3.6388636e-5,+ 575.5476,+ 598.5189,+ 30.391796,+ 83.80691,+ 41.881798,+ 605.89923,+ 228.19566,+ 607.115,+ 0.9846453,+ 26.751215,+ 423.71878,+ 604.71936,+ 524.8006,+ 608.7336,+ 604.7272,+ 0.00017011166,+ 85.2054,+ 614.167,+ 180.54138,+ 236.0608,+ 40.931595,+ 613.3228,+ 378.90158,+ 616.0361,+ 0.98468065,+ 23.621319,+ 580.57715,+ 613.8574,+ 36.021698,+ 622.9237,+ 620.6479,+ 0.00017055869,+ 237.93532,+ 622.88293,+ 333.23038,+ 388.55804,+ 37.262794,+ 620.94507,+ 532.91406,+ 623.81396,+ 0.98479754,+ 21.303564,+ 90.4161,+ 631.0862,+ 186.60384,+ 629.50543,+ 629.1974,+ 6.684661e-5,+ 389.7323,+ 630.75946,+ 485.67264,+ 540.7903,+ 31.03635,+ 627.4575,+ 45.41445,+ 636.3603,+ 0.98466337,+ 23.84736,+ 242.09274,+ 636.4479,+ 338.24374,+ 637.30426,+ 635.3289,+ 0.00014019012,+ 542.3287,+ 636.5928,+ 637.77094,+ 101.30148,+ 24.35305,+ 18.754171,+ 380.82364,+ 19.239986,+ 0.98310304,+ 62.180244,+ 128.66052,+ 32.537575,+ 330.97415,+ 31.571672,+ 27.78136,+ 2.861023e-5,+ 102.198685,+ 50.348396,+ 294.28836,+ 409.81924,+ 71.35615,+ 32.865463,+ 43.072823,+ 75.82796,+ 0.983128,+ 82.01232,+ 437.30798,+ 48.770855,+ 5.7028737,+ 79.66438,+ 72.22586,+ 8.046627e-6,+ 415.79178,+ 76.99779,+ 609.7155,+ 67.85562,+ 81.99003,+ 93.02436,+ 347.281,+ 109.204475,+ 0.98314685,+ 29.75526,+ 96.24182,+ 99.27687,+ 295.35687,+ 126.03145,+ 103.87391,+ 0.00010225177,+ 67.21732,+ 134.62173,+ 275.4083,+ 378.41937,+ 97.84645,+ 118.07856,+ 11.28749,+ 168.43675,+ 0.9831436,+ 88.71972,+ 392.89774,+ 120.48595,+ 615.8362,+ 164.73079,+ 149.3369,+ 1.1622906e-6,+ 383.81277,+ 156.11198,+ 581.91565,+ 34.24012,+ 108.06907,+ 153.06912,+ 323.30484,+ 183.03503,+ 0.9831792,+ 19.50693,+ 63.346416,+ 165.09476,+ 272.66464,+ 196.75096,+ 177.87074,+ 4.6789646e-6,+ 32.13368,+ 214.20879,+ 253.24176,+ 345.6622,+ 101.57759,+ 194.24965,+ 630.72516,+ 235.08292,+ 0.9832144,+ 89.68304,+ 367.9388,+ 209.0818,+ 583.5032,+ 245.70026,+ 229.62675,+ 8.940697e-8,+ 358.25256,+ 249.81882,+ 552.9115,+ 11.2338085,+ 89.18978,+ 248.5412,+ 295.3977,+ 277.14334,+ 0.98315644,+ 51.403435,+ 41.208347,+ 251.75754,+ 236.46092,+ 291.46524,+ 264.20474,+ 5.543232e-6,+ 10.105693,+ 295.47845,+ 225.61029,+ 312.85492,+ 89.9268,+ 275.84912,+ 601.09863,+ 309.0078,+ 0.9832275,+ 89.95977,+ 337.851,+ 290.3271,+ 552.8325,+ 328.21103,+ 309.158,+ 5.9604645e-8,+ 325.91693,+ 327.02945,+ 525.90173,+ 615.3737,+ 72.18379,+ 323.32864,+ 264.10666,+ 359.32983,+ 0.983182,+ 78.98007,+ 11.737658,+ 332.69708,+ 206.09589,+ 368.4965,+ 344.68726,+ 7.4505806e-7,+ 617.8864,+ 368.25714,+ 186.38411,+ 282.39438,+ 104.40619,+ 356.43286,+ 578.09045,+ 389.86862,+ 0.9831766,+ 89.65222,+ 303.21835,+ 365.8461,+ 521.03076,+ 389.4765,+ 392.94708,+ 1.1920929e-7,+ 301.04324,+ 404.9389,+ 496.78326,+ 585.23645,+ 57.853157,+ 410.89337,+ 234.01193,+ 430.98468,+ 0.98323464,+ 86.36004,+ 627.9563,+ 424.1357,+ 172.58478,+ 444.20697,+ 420.1698,+ 1.7881393e-7,+ 592.5604,+ 447.432,+ 141.04831,+ 250.01892,+ 104.2092,+ 438.2741,+ 547.75,+ 450.6507,+ 0.9831966,+ 90.29617,+ 272.23898,+ 453.93576,+ 482.6475,+ 485.30148,+ 475.4653,+ 2.3841858e-7,+ 261.24643,+ 481.0445,+ 463.2233,+ 553.05994,+ 61.750645,+ 494.39966,+ 206.39441,+ 511.84967,+ 0.9832107,+ 89.81447,+ 598.79266,+ 509.715,+ 130.88718,+ 524.6691,+ 509.39688,+ 8.34465e-7,+ 577.70746,+ 528.2044,+ 96.39044,+ 217.72835,+ 80.876465,+ 541.55927,+ 512.80865,+ 545.1863,+ 0.9831842,+ 89.54824,+ 248.80144,+ 555.82825,+ 451.09412,+ 567.22894,+ 556.68604,+ 2.3543835e-6,+ 223.14444,+ 578.1582,+ 416.05273,+ 516.7762,+ 82.21459,+ 594.39014,+ 154.94559,+ 599.0725,+ 0.98309535,+ 90.555275,+ 565.4041,+ 590.27026,+ 101.06813,+ 605.2649,+ 587.3118,+ 7.4505806e-7,+ 538.3086,+ 589.80536,+ 63.48048,+ 184.29768,+ 56.97348,+ 616.25555,+ 475.86484,+ 623.4611,+ 0.9831587,+ 88.119705,+ 219.37065,+ 626.11414,+ 418.69577,+ 636.1307,+ 614.7107,+ 2.0354986e-5,+ 190.3317,+ 633.6443,+ 382.64496,+ 491.88727,+ 15.959411,+ 16.060616,+ 120.17935,+ 21.48739,+ 0.9842471,+ 107.67451,+ 517.50934,+ 8.176455,+ 69.31,+ 32.848186,+ 31.127954,+ 0.00018653274,+ 496.80103,+ 24.273842,+ 35.29885,+ 152.73332,+ 43.509117,+ 47.24798,+ 422.1092,+ 64.82291,+ 0.9842599,+ 92.2622,+ 170.51752,+ 54.13866,+ 371.47223,+ 72.94313,+ 55.699722,+ 3.4064054e-5,+ 154.3356,+ 83.46527,+ 343.2411,+ 459.6028,+ 96.20762,+ 85.21646,+ 83.13757,+ 113.9664,+ 0.9843098,+ 131.54982,+ 476.92587,+ 84.731445,+ 37.56116,+ 131.05716,+ 106.0194,+ 0.00013419986,+ 462.52878,+ 109.088745,+ 12.858007,+ 123.99827,+ 113.330315,+ 115.52525,+ 391.6506,+ 149.90044,+ 0.9843087,+ 63.804516,+ 122.62096,+ 123.705376,+ 341.781,+ 170.65617,+ 137.4707,+ 5.301833e-5,+ 119.44427,+ 158.48402,+ 336.91528,+ 425.63416,+ 157.66258,+ 145.10736,+ 50.259747,+ 209.38344,+ 0.98429126,+ 152.65842,+ 428.9864,+ 155.9346,+ 8.607111,+ 211.8723,+ 181.05138,+ 5.364418e-7,+ 439.66187,+ 197.85431,+ 620.19855,+ 86.84066,+ 181.4533,+ 202.27032,+ 370.75674,+ 240.98679,+ 0.9843159,+ 48.352303,+ 94.948105,+ 206.93098,+ 314.671,+ 251.22519,+ 215.19571,+ 0.00014549494,+ 82.18913,+ 250.16402,+ 300.98035,+ 391.64505,+ 167.64801,+ 228.99097,+ 24.318483,+ 295.3332,+ 0.98429555,+ 151.88336,+ 409.28543,+ 237.67531,+ 620.72375,+ 290.6942,+ 265.91095,+ 8.34465e-7,+ 402.65613,+ 279.96637,+ 594.14484,+ 49.77883,+ 178.25893,+ 281.48355,+ 340.95834,+ 316.7371,+ 0.9843285,+ 31.544086,+ 72.5918,+ 284.58582,+ 278.55832,+ 327.54642,+ 293.5809,+ 1.8119812e-5,+ 49.67664,+ 331.9037,+ 271.58545,+ 362.12784,+ 159.3243,+ 307.81308,+ 4.2018056,+ 362.32123,+ 0.9842633,+ 157.93625,+ 378.3634,+ 318.49963,+ 591.95465,+ 362.30826,+ 342.95825,+ 4.4703484e-7,+ 376.52225,+ 360.38904,+ 572.763,+ 23.532421,+ 167.67654,+ 356.58997,+ 311.74066,+ 402.088,+ 0.9843173,+ 36.942764,+ 50.825787,+ 364.1832,+ 247.80551,+ 414.72864,+ 375.0413,+ 9.834766e-6,+ 17.012777,+ 405.68927,+ 242.74799,+ 330.05905,+ 171.28976,+ 385.66342,+ 617.8709,+ 431.85056,+ 0.984298,+ 152.18474,+ 343.98065,+ 397.5357,+ 562.7884,+ 440.78854,+ 426.5438,+ 6.556511e-7,+ 343.14484,+ 440.8884,+ 546.3341,+ 625.0967,+ 80.18937,+ 436.96075,+ 279.7053,+ 479.57004,+ 0.98428524,+ 92.64935,+ 22.026814,+ 448.9525,+ 217.09557,+ 489.45322,+ 455.61682,+ 1.8179417e-5,+ 628.0091,+ 486.11966,+ 205.29979,+ 295.52286,+ 156.79535,+ 477.5694,+ 591.7582,+ 508.23782,+ 0.98430693,+ 154.26234,+ 311.90698,+ 483.41785,+ 535.4055,+ 504.38046,+ 503.37762,+ 5.066395e-7,+ 313.7824,+ 523.2537,+ 515.45776,+ 598.2962,+ 69.51947,+ 533.551,+ 241.36813,+ 554.9179,+ 0.9843614,+ 139.08853,+ 4.038402,+ 550.28546,+ 180.19374,+ 572.5241,+ 542.58954,+ 5.2005053e-5,+ 604.8295,+ 567.772,+ 154.69528,+ 266.14627,+ 89.8714,+ 579.8016,+ 555.7725,+ 593.1318,+ 0.98432463,+ 148.7981,+ 281.56253,+ 592.0284,+ 486.65558,+ 591.2541,+ 589.93896,+ 2.631545e-5,+ 278.9292,+ 612.85223,+ 479.54233,+ 569.10077,+ 62.74629,+ 615.6756,+ 205.78098,+ 626.4543,+ 0.98424095,+ 152.28871,+ 613.1439,+ 628.9044,+ 151.33585,+ 632.5167,+ 618.3635,+ 1.92523e-5,+ 580.0863,+ 635.6231,+ 128.38039,+ 233.88618,+ 25.176886,+ 632.72614,+ 518.32623,+ 634.7904,+ 0.9844465,+ 143.73271,+ 261.06555,+ 11.4491205,+ 450.67416,+ 22.258984,+ 29.110611,+ 0.00027251244,+ 234.72395,+ 29.73882,+ 430.16132,+ 535.4884,+ 53.054234,+ 43.540512,+ 162.4738,+ 63.86522,+ 0.98439753,+ 186.6512,+ 564.4358,+ 52.271564,+ 104.447235,+ 69.83408,+ 58.40217,+ 0.00025957823,+ 559.75494,+ 54.1118,+ 80.00354,+ 202.04372,+ 78.28848,+ 72.75352,+ 472.07532,+ 92.19342,+ 0.9844099,+ 165.22052,+ 212.28998,+ 80.14371,+ 411.0087,+ 115.66134,+ 108.866264,+ 6.997585e-5,+ 209.13274,+ 117.5182,+ 403.5075,+ 503.98206,+ 77.04492,+ 119.21255,+ 129.59508,+ 160.90878,+ 0.9843973,+ 191.96805,+ 521.95056,+ 128.02191,+ 78.207596,+ 167.38763,+ 137.88896,+ 0.00025844574,+ 527.64557,+ 140.43945,+ 51.218277,+ 167.51968,+ 153.76302,+ 137.2656,+ 440.71634,+ 187.38141,+ 0.98446846,+ 183.70607,+ 175.87206,+ 134.79659,+ 385.85156,+ 205.42517,+ 169.57756,+ 1.564622e-5,+ 178.71704,+ 191.09671,+ 395.3852,+ 472.5462,+ 189.16888,+ 196.4705,+ 87.91501,+ 248.31046,+ 0.98434114,+ 225.30313,+ 488.6092,+ 191.14429,+ 47.352253,+ 258.78317,+ 217.09877,+ 1.1026859e-5,+ 494.46695,+ 236.51971,+ 19.327103,+ 140.97433,+ 230.85454,+ 229.97696,+ 418.6155,+ 283.57117,+ 0.9844035,+ 108.087875,+ 137.08633,+ 232.16222,+ 354.4995,+ 291.4391,+ 247.57637,+ 9.775162e-6,+ 140.48123,+ 284.33087,+ 358.06396,+ 443.154,+ 206.67168,+ 254.4486,+ 59.630417,+ 328.93607,+ 0.98437285,+ 186.12148,+ 452.72412,+ 269.02014,+ 19.060757,+ 343.9124,+ 296.17227,+ 1.4036894e-5,+ 458.85855,+ 317.5959,+ 627.0732,+ 106.759674,+ 230.2705,+ 310.65103,+ 381.48688,+ 367.40427,+ 0.9843849,+ 75.95674,+ 98.26803,+ 313.87006,+ 319.59488,+ 370.02167,+ 327.2194,+ 8.404255e-6,+ 103.47601,+ 357.0504,+ 328.00354,+ 409.6785,+ 228.3022,+ 336.3217,+ 33.35457,+ 413.4009,+ 0.98431945,+ 213.60678,+ 413.97592,+ 345.24374,+ 3.5024714,+ 411.69913,+ 378.21768,+ 1.9520521e-5,+ 423.96832,+ 396.23367,+ 604.46625,+ 69.82809,+ 230.36151,+ 389.68558,+ 350.32352,+ 436.65173,+ 0.9843866,+ 45.807884,+ 85.2825,+ 393.76917,+ 293.8789,+ 445.74957,+ 404.90775,+ 6.380677e-5,+ 67.77082,+ 444.49487,+ 292.55176,+ 377.8828,+ 232.96074,+ 421.34464,+ 9.849878,+ 492.0474,+ 0.98435634,+ 215.38986,+ 383.65225,+ 428.07813,+ 614.12555,+ 479.65027,+ 458.36398,+ 1.4275312e-5,+ 394.10947,+ 481.4609,+ 591.46155,+ 38.2454,+ 207.75552,+ 465.68073,+ 323.50037,+ 510.49652,+ 0.98437303,+ 35.415783,+ 56.900696,+ 469.16763,+ 261.88284,+ 518.0956,+ 485.1627,+ 0.000117987394,+ 34.911636,+ 533.7227,+ 257.16092,+ 345.68655,+ 160.2934,+ 516.48236,+ 627.21985,+ 559.4473,+ 0.984377,+ 215.4888,+ 357.1851,+ 521.2689,+ 575.6235,+ 562.2464,+ 537.9089,+ 1.4364719e-5,+ 359.46548,+ 573.2016,+ 562.03864,+ 15.611118,+ 128.16719,+ 573.3909,+ 283.62903,+ 604.8058,+ 0.9844252,+ 71.38571,+ 27.663198,+ 586.0859,+ 219.85431,+ 612.0073,+ 568.1088,+ 0.00011271238,+ 13.747232,+ 616.7131,+ 214.23091,+ 313.02542,+ 97.30427,+ 609.0454,+ 596.63916,+ 634.9688,+ 0.98435473,+ 216.92432,+ 323.31558,+ 605.0193,+ 531.71924,+ 635.64374,+ 612.6743,+ 2.0742416e-5,+ 330.09152,+ 631.5845,+ 527.11774,+ 613.17413,+ 41.128075,+ 633.78687,+ 257.4225,+ 636.7932,+ 0.98432606,+ 120.69495,+ 23.714222,+ 45.540585,+ 393.9683,+ 41.868942,+ 47.479424,+ 0.0014618933,+ 622.76117,+ 88.508896,+ 352.77887,+ 552.18976,+ 196.78679,+ 106.83235,+ 487.51422,+ 181.03165,+ 0.98408914,+ 266.37656,+ 4.3654327,+ 129.40067,+ 377.72336,+ 225.11096,+ 210.30884,+ 2.8192997e-5,+ 598.2776,+ 282.06122,+ 373.3568,+ 527.4766,+ 290.04218,+ 289.94977,+ 484.5149,+ 348.1499,+ 0.98408866,+ 372.53207,+ 614.47644,+ 314.58795,+ 348.02444,+ 425.7661,+ 369.28683,+ 7.7575445e-5,+ 582.20654,+ 438.30405,+ 337.37433,+ 493.1391,+ 196.58073,+ 445.0213,+ 456.33176,+ 502.59482,+ 0.9840781,+ 405.46365,+ 596.04584,+ 546.52954,+ 317.7196,+ 594.116,+ 532.00433,+ 0.0020077825,+ 560.15625,+ 612.83905,+ 294.62988,+ 458.04465,+ 101.02823,+ 635.89166,+ 398.8073,+ 624.5083,+ 0.9840838,+ 342.16864,+ 535.3857,+ 36.4112,+ 267.44812,+ 39.394268,+ 50.415485,+ 0.0002732575,+ 502.4096,+ 90.55659,+ 223.15787,+ 435.45618,+ 132.65312,+ 116.05974,+ 338.3723,+ 133.70358,+ 0.9833487,+ 293.10513,+ 496.5314,+ 154.39827,+ 239.9727,+ 208.90553,+ 205.03223,+ 9.5039606e-5,+ 483.1577,+ 227.11868,+ 224.20111,+ 404.48312,+ 340.00464,+ 277.65176,+ 340.0507,+ 375.5011,+ 0.9833471,+ 424.04462,+ 480.6252,+ 328.31506,+ 212.62254,+ 411.9498,+ 363.35233,+ 0.00011917949,+ 456.8983,+ 404.55963,+ 176.59293,+ 369.5963,+ 445.65726,+ 448.4526,+ 317.1335,+ 534.8705,+ 0.98336345,+ 436.79254,+ 434.75137,+ 499.61267,+ 164.01212,+ 585.85986,+ 493.8402,+ 0.0019411147,+ 417.9704,+ 611.06433,+ 111.89922,+ 340.0566,+ 166.82283,+ 629.5765,+ 272.6416,+ 635.4557,+ 0.98334056,+ 359.89993,+ 383.75308,+ 613.0372,+ 125.65506,+ 45.61785,+ 39.02632,+ 0.0011974573,+ 362.4817,+ 45.20456,+ 67.269035,+ 309.5877,+ 158.37306,+ 104.98723,+ 207.2786,+ 160.07811,+ 0.98337185,+ 301.30518,+ 339.4206,+ 125.48934,+ 110.87725,+ 214.90147,+ 180.42049,+ 0.00010895729,+ 368.39774,+ 231.3281,+ 28.75362,+ 271.83127,+ 395.30496,+ 268.1355,+ 206.09415,+ 376.68057,+ 0.98336554,+ 325.7198,+ 295.46008,+ 281.59128,+ 79.73298,+ 419.08322,+ 335.8333,+ 8.267164e-5,+ 343.36667,+ 406.15128,+ 18.96652,+ 242.03534,+ 459.0092,+ 391.03577,+ 159.93896,+ 514.92346,+ 0.9833615,+ 261.11267,+ 273.2215,+ 484.59323,+ 35.195435,+ 573.37415,+ 495.09094,+ 0.0001526773,+ 297.35242,+ 630.6074,+ 618.6597,+ 210.89789,+ 164.80562,+ 603.5239,+ 118.27537,+ 636.6162,+ 0.98337096,+ 254.17241,+ 254.94426,+ 622.87476,+ ],+ },+ GoldenEntry {+ model_file: "mobilefacenet_portable_static_b1.onnx",+ model_sha256: "0763fc33f54e138476194da95987e133b3e976075a6b1d3e1b2caedb251b1a36",+ input: GoldenInput::SeededF32 {+ seed: 0x601de25eed2026,+ },+ input_shape: &[1, 112, 112, 3],+ metric: GoldenMetric::CosineDistance,+ output_len: 192,+ expected_sample: &[+ -0.20304881,+ 0.7936697,+ 0.4473748,+ 0.007939864,+ -1.7662135,+ 1.830292,+ -1.7912871,+ -0.0589097,+ 1.5594349,+ -1.0079376,+ -0.56120265,+ 0.20544386,+ -0.14646938,+ 0.8072367,+ -0.018681785,+ -1.2971327,+ -0.83451,+ -0.32997352,+ -0.042894855,+ 0.15165739,+ -4.23538,+ 2.606911,+ -0.60485727,+ 0.37686744,+ 1.7754534,+ 0.411365,+ -1.3860472,+ 3.1698158,+ 3.9376936,+ -1.5248591,+ -0.33990988,+ 5.4873157,+ 1.3594699,+ 0.054467764,+ 1.6922474,+ 2.4775689,+ -0.78024,+ -0.5872245,+ 0.042111065,+ -2.1717818,+ 0.29034483,+ 0.16180407,+ 0.45550483,+ -0.2489255,+ 0.3560929,+ -1.6286275,+ -4.1791525,+ -0.9639648,+ -0.43752402,+ 1.4459174,+ -1.7070876,+ -0.23215714,+ -4.8167505,+ -0.05731062,+ -1.2101297,+ 0.3099752,+ 1.7793403,+ 0.10760556,+ -3.1642368,+ 0.8622221,+ 0.9205293,+ -1.6756979,+ -2.057802,+ -1.566759,+ -0.53685373,+ 0.36050043,+ -0.24986313,+ 0.30559096,+ 0.23402828,+ 0.14326286,+ -1.0127417,+ 0.17559892,+ 0.4210908,+ 0.28339028,+ -1.7929939,+ 0.22922142,+ 0.12484618,+ -0.020807967,+ 5.9051075,+ -0.007121235,+ -0.33293793,+ 0.65066785,+ -0.33826593,+ 4.444774,+ -1.5199617,+ -0.1029282,+ -0.16840984,+ -1.4247704,+ 1.4705966,+ -2.8846457,+ 1.6463094,+ -0.044491738,+ 0.27420697,+ -0.7413186,+ -0.9072233,+ -2.7961612,+ -0.8288831,+ -0.18095192,+ 0.037954837,+ 0.18612169,+ 0.054952465,+ -0.52322286,+ -0.28278267,+ -0.04524642,+ -0.15231861,+ 0.17559642,+ -5.0228257,+ 0.16283432,+ 0.092375174,+ 0.35656783,+ -1.6686989,+ 0.26297435,+ 0.24994686,+ 7.943999,+ 0.3372757,+ 3.6603498,+ -0.14963034,+ -1.0193563,+ 0.5833788,+ 4.4583454,+ 5.80196,+ 0.06960823,+ -3.0902903,+ -0.09705033,+ 0.025184188,+ -0.06412993,+ 0.20611048,+ -0.0071959496,+ -0.07608488,+ 0.31496787,+ 0.33409393,+ 0.77111375,+ -0.027405865,+ -0.49266738,+ 1.0182828,+ -0.3875988,+ -5.2687325,+ 1.0393836,+ 0.19998515,+ 0.35080317,+ -0.2349202,+ 0.053013604,+ -0.03558293,+ -1.5110149,+ -3.3037884,+ 1.6808654,+ -0.62730765,+ -0.053740375,+ 0.2903124,+ -0.2886686,+ -0.17602324,+ -2.4843295,+ 0.2184573,+ -0.83189255,+ -0.2735375,+ 0.0023702066,+ 0.07315011,+ 0.16453096,+ -2.226248,+ -0.09618334,+ -2.1187148,+ 0.0049999896,+ -0.32150725,+ 0.012969767,+ 0.16663133,+ 0.66567075,+ 0.62270385,+ -1.5689095,+ -0.04352192,+ 0.035052303,+ 6.062924,+ 1.835436,+ -0.08589032,+ -0.16515218,+ 0.9898539,+ 0.11412544,+ -0.7350553,+ -2.514508,+ -0.35223264,+ 0.2743979,+ -2.0918343,+ -0.4855199,+ -0.0014096638,+ -0.14882992,+ 3.3249786,+ -0.46734107,+ -2.6806278,+ 2.3625948,+ 2.7410185,+ -0.9942872,+ -2.1433127,+ -0.37603956,+ ],+ },+ GoldenEntry {+ model_file: "mobileclip_s2_image_gelu_opset20.onnx",+ model_sha256: "205a430af825e501c5138e5bb9abea942482a7a4fd4a680e98e47cf0830dce7e",+ input: GoldenInput::SeededF32 {+ seed: 0x601de25eed2026,+ },+ input_shape: &[1, 3, 256, 256],+ metric: GoldenMetric::CosineDistance,+ output_len: 512,+ expected_sample: &[+ -0.012067769,+ 0.055743605,+ 0.025255125,+ -0.041616585,+ -0.042562664,+ 0.018893166,+ 0.06428001,+ 0.019084154,+ 0.018842814,+ -0.04485963,+ 0.032005012,+ 0.018449724,+ 0.019154841,+ -0.022057975,+ 0.0051256744,+ 0.054973647,+ 0.03585164,+ -0.04355979,+ 0.034456875,+ 0.09257709,+ -0.001381518,+ 0.03605838,+ 0.025300095,+ -0.046100207,+ 0.042938296,+ 0.025185347,+ 0.025803085,+ 0.027804602,+ -0.012268654,+ 0.05636481,+ -0.0058787153,+ 0.03451548,+ -0.037462052,+ -0.0030833844,+ -0.033459328,+ 0.027150264,+ -0.06546446,+ 0.007718145,+ -0.018221248,+ 0.03234384,+ 0.061624214,+ 0.070668094,+ 0.06062955,+ 0.0118763475,+ -0.027700145,+ -0.017873634,+ -0.052757706,+ -0.060518008,+ 0.064579085,+ 0.061390758,+ -0.010279377,+ 0.03618429,+ -0.015320818,+ -0.017419651,+ -0.049488693,+ -0.02826559,+ 0.041876495,+ -0.018803347,+ -0.08951773,+ -0.028724115,+ 0.024558542,+ -0.06297565,+ 0.025423722,+ 0.0044169645,+ 0.00591211,+ 0.4560945,+ 0.030367034,+ 0.0030921262,+ 0.02762173,+ -0.08520002,+ 0.03531445,+ 0.05904264,+ -0.024404425,+ 0.05129122,+ 0.019687885,+ 0.009428367,+ 0.04253668,+ -0.033883557,+ -0.008409625,+ 0.016125174,+ 0.006272315,+ 0.008730768,+ 0.062403202,+ -0.010827548,+ 0.020095084,+ -0.006315342,+ 0.035176363,+ 0.02027424,+ -0.0071223294,+ -0.038671426,+ 0.065887876,+ 0.025977148,+ -0.036064234,+ -0.03162256,+ 0.04843083,+ 0.060103774,+ 0.051812172,+ 0.03727613,+ -0.07018727,+ -0.002755645,+ -0.016848048,+ -0.00079788035,+ 0.0029924954,+ -0.01479737,+ -0.004046765,+ 0.04101869,+ -0.54772174,+ -0.023201391,+ 0.017706603,+ 0.019685302,+ -0.0006951592,+ -0.024045559,+ 0.023264507,+ 0.0071952413,+ 0.030655278,+ -0.08273939,+ -0.0059551937,+ 0.0022886323,+ -0.06270315,+ -0.0067036324,+ -0.0071682655,+ -0.021102488,+ -0.02521998,+ 0.05939022,+ 0.024908273,+ -0.030375993,+ 0.031351283,+ -0.047054604,+ 0.011896478,+ -0.042368285,+ 0.00010387844,+ 0.010745343,+ 0.038807467,+ -0.036697384,+ 0.006480158,+ 0.007602038,+ 0.0036259203,+ 0.016408697,+ 0.0046317843,+ 0.013770057,+ -0.010438016,+ -0.013394592,+ 0.021964109,+ -0.0065490073,+ -0.009421287,+ -0.017836327,+ 0.0028402924,+ 0.057745162,+ -0.03663877,+ -0.048511375,+ -0.0063450877,+ 0.008656265,+ 0.040955853,+ 0.040617052,+ -0.029687634,+ 0.012490716,+ -0.037286345,+ 0.0046911063,+ 0.06835926,+ 0.027632203,+ -0.015728837,+ -0.007681341,+ -0.025706908,+ -0.005568491,+ 0.035422552,+ -0.031538848,+ 0.0019310458,+ -0.05492298,+ -0.014792578,+ 0.022747038,+ -0.013803249,+ 0.58487356,+ 0.034183417,+ 0.019469298,+ 0.011844912,+ -0.022831855,+ 0.00032239978,+ 0.014665857,+ -0.031707577,+ 0.04419308,+ -0.029912163,+ 0.002711701,+ 0.095216185,+ -0.005897038,+ 0.08654718,+ -0.0013477335,+ 0.008026498,+ 0.039948158,+ 0.020458473,+ 0.048937086,+ 0.023564886,+ -0.012591404,+ -0.05600715,+ 0.048547246,+ -0.00925025,+ 0.03680177,+ -0.015632017,+ -0.11399353,+ -0.029384231,+ 0.020521428,+ 0.10903471,+ -0.030845305,+ 0.079442464,+ -0.008189603,+ -0.013922557,+ -0.005319472,+ -0.031818334,+ -0.014392788,+ 0.022564579,+ 0.026917469,+ 0.050772175,+ -0.0062358766,+ -0.06543448,+ -0.036246024,+ 0.023064803,+ 0.048260435,+ -0.018026665,+ -0.03645457,+ 0.001876284,+ 0.047471214,+ 0.11633373,+ 0.0045632105,+ 0.018702209,+ -0.022980269,+ 0.026724553,+ -0.055189926,+ -0.035965458,+ -0.016578617,+ -0.06235588,+ -0.0024853323,+ 0.017526306,+ 0.027339734,+ 0.018817239,+ -0.05128129,+ 0.016830582,+ 0.010735734,+ -0.053119425,+ 0.003763133,+ 0.025415177,+ -0.0621581,+ 0.044614,+ -0.06362346,+ 0.028562145,+ 0.054534007,+ 0.0101022925,+ 0.011432085,+ 0.22580644,+ -0.075911105,+ -0.045082014,+ 0.020991176,+ -0.046628784,+ -0.011159168,+ 0.025564142,+ 0.10236002,+ -0.072836295,+ -0.002840907,+ -0.0091601955,+ -0.1214389,+ 0.021036567,+ 0.017621348,+ -0.027298432,+ 0.014351323,+ -0.04302945,+ -0.042780068,+ 0.03488952,+ 0.0057220296,+ 0.008108137,+ 0.018803159,+ 0.03548475,+ -0.039372686,+ -0.012754863,+ -0.039630294,+ 0.065796085,+ 0.019384487,+ -0.0067858184,+ -0.0063806246,+ -0.0074199983,+ -0.0048156246,+ -0.020265562,+ 0.03418463,+ -0.006972899,+ 0.02674174,+ 0.009134578,+ 0.04514048,+ 0.00022561887,+ -0.015720582,+ 0.050401025,+ -0.02178854,+ 0.0287226,+ 0.04749001,+ -0.0062945145,+ -0.16001879,+ 0.008538586,+ 0.0013160189,+ -0.055483084,+ -0.008708798,+ -0.1826161,+ 0.04797323,+ -0.032910667,+ -0.035842627,+ 0.04489189,+ -0.021654744,+ 0.040914427,+ 0.13351876,+ -0.013793565,+ 0.050052486,+ -0.008650193,+ -0.0029841855,+ 0.0019374354,+ -0.0025981579,+ 0.044275705,+ -0.08533808,+ 0.0073180217,+ -0.025965951,+ -0.022524346,+ -0.026792338,+ -0.5518786,+ 0.022886978,+ 0.041101854,+ 0.05858722,+ -0.013066036,+ -0.048834167,+ 0.022210782,+ -0.008949283,+ -0.07804248,+ 0.026853096,+ -0.02343857,+ 0.016888473,+ 0.0039974404,+ 0.01520543,+ -0.03223185,+ 0.04530838,+ 0.022596663,+ 0.027941577,+ -0.033771373,+ -0.015221248,+ 0.024659678,+ -0.04510133,+ 0.0015056237,+ 0.024782497,+ 0.015653655,+ -0.026184848,+ 0.015035842,+ 0.033577118,+ -0.018414892,+ 0.041655153,+ -0.05611223,+ 0.050415896,+ 0.060815785,+ 0.013022142,+ 0.03448335,+ 0.040853042,+ 0.0068591284,+ -0.080724955,+ 0.008609293,+ -0.015545952,+ -0.024180405,+ -0.04208358,+ 0.008473901,+ -0.043360732,+ -0.01613887,+ -0.021955451,+ 0.002165118,+ 0.02007157,+ 0.009798298,+ 0.0045983377,+ -0.018892456,+ -0.019843582,+ 0.044853393,+ 0.00039856834,+ 0.00065667735,+ 0.01918223,+ -0.04188631,+ 0.0025628908,+ -0.024794938,+ -0.012224148,+ 0.04340824,+ -0.03676601,+ -0.038467783,+ 0.019648692,+ -0.063363336,+ 0.029884104,+ -0.034307707,+ 0.003574574,+ 0.12630007,+ 0.0155397905,+ -0.054956242,+ 0.013771814,+ 0.065102294,+ -0.00025801192,+ -0.111849815,+ -0.020661956,+ 0.044851072,+ -0.043962896,+ -0.04551725,+ 0.014417945,+ -0.008076762,+ 0.025636744,+ 0.034174614,+ -0.1275617,+ -0.027495684,+ 0.017066184,+ 0.01935468,+ -0.07563934,+ 0.05095021,+ 0.06110156,+ -0.020736374,+ 0.111736506,+ -0.02127259,+ -0.09814772,+ -0.00022941346,+ -0.022959007,+ -0.05476967,+ 0.049576122,+ 0.047000345,+ 0.020935575,+ 0.0058465274,+ 0.13205187,+ -0.055662777,+ -0.026858116,+ -0.03784805,+ -0.016275778,+ -0.01222755,+ -0.06459003,+ -0.0028608365,+ -0.078123026,+ -0.057177037,+ -0.011758229,+ 0.00046511294,+ -0.017937027,+ -0.011331961,+ 0.08329482,+ -0.04286211,+ -0.020089611,+ 0.02444188,+ -0.014174293,+ 0.011303754,+ -0.0014018626,+ -0.05837405,+ 0.009694204,+ 0.002396594,+ 0.0093555655,+ 0.014485615,+ 0.049410902,+ -0.00085992436,+ -0.030446546,+ 0.026651112,+ 0.015821325,+ 0.05480218,+ 0.009279644,+ 0.18069762,+ -0.082800955,+ -0.032764714,+ 0.07131627,+ 0.03566366,+ 0.0071427063,+ -0.017366268,+ -0.022706814,+ 0.015796939,+ -0.045192763,+ 0.035283867,+ -0.043262813,+ -0.026151728,+ 0.0009926385,+ 0.001716688,+ 0.03967804,+ 0.005981116,+ -0.043754976,+ 0.046544302,+ -0.09599101,+ 0.045154653,+ -0.025925823,+ 0.031259317,+ -0.008948715,+ -0.08874161,+ -0.045448527,+ -0.058519043,+ 0.027748907,+ -0.026759954,+ 0.015577119,+ 0.00842582,+ -0.03306421,+ -0.018280441,+ 0.008462797,+ -0.12165598,+ 0.041323733,+ -0.11944126,+ -0.03631121,+ 0.014478144,+ -0.043063607,+ 0.08449178,+ -0.07838379,+ 0.04468432,+ 0.03316168,+ 0.058126688,+ -0.033534124,+ -0.0189542,+ 0.026265023,+ -0.030902762,+ 0.02669059,+ 0.004073317,+ -0.026193807,+ 0.007432396,+ 0.019635089,+ -0.013814654,+ 0.04260668,+ 0.031500734,+ 0.062472444,+ -0.034398526,+ -0.024923678,+ -0.04649835,+ -0.10394406,+ ],+ },+ GoldenEntry {+ model_file: "mobileclip_s2_text_opset18_quant.onnx",+ model_sha256: "d92f33dfcff83077fc2e0d3414250710efbb51795dfd89767bdbefb5fdc47322",+ input: GoldenInput::I32 {+ data: &[+ 49406, 320, 1125, 539, 320, 1929, 1629, 525, 320, 5438, 2117, 49407, 0, 0, 0, 0, 0,+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,+ 0, 0, 0, 0,+ ],+ },+ input_shape: &[1, 77],+ metric: GoldenMetric::CosineDistance,+ output_len: 512,+ expected_sample: &[+ -0.02228204,+ 0.23076442,+ 0.112314396,+ -0.41341254,+ -0.13989246,+ 0.4527452,+ 0.13349847,+ 0.118902124,+ -0.38099056,+ 0.50732005,+ 0.3363619,+ -0.21584514,+ -0.64307904,+ 0.23547918,+ -0.07059208,+ 4.271047,+ 0.05780413,+ 0.23786883,+ 0.33674943,+ -0.24723375,+ 0.24878381,+ -0.2151347,+ 0.37698627,+ -0.12930042,+ 0.28889146,+ -0.19905289,+ 0.31020474,+ 0.03623253,+ -0.2675782,+ 0.002712596,+ 0.2950917,+ -0.16902056,+ -0.22114116,+ -0.36174405,+ -0.12581278,+ -0.20176548,+ 0.13298179,+ -0.13117339,+ -0.46146426,+ 0.09862224,+ 0.077890255,+ 0.20273426,+ -0.04998927,+ -0.09293871,+ -0.044176564,+ 0.11573743,+ -0.23212072,+ -0.23095818,+ -0.08363838,+ 0.076146446,+ 0.27881613,+ 0.42561924,+ 0.26215303,+ 0.03629712,+ 0.09080738,+ -0.28630805,+ -0.124198146,+ 0.17347698,+ -0.42432752,+ -0.07278799,+ -0.33959118,+ 0.1302692,+ -0.36994642,+ 0.17896675,+ 0.88010824,+ 0.14409052,+ -0.1172229,+ 0.07407971,+ 0.21771812,+ -0.8070619,+ 0.018213145,+ 0.09571589,+ 0.28585595,+ 0.15016156,+ 0.020602813,+ 0.073692195,+ -0.37789047,+ 0.31653413,+ 0.27145335,+ -0.17522079,+ -0.2304415,+ 0.07220672,+ 0.3840261,+ 0.1535846,+ 0.00077502744,+ -0.2582779,+ 0.06045214,+ -0.03255115,+ -0.27332634,+ -0.18846084,+ -0.12626489,+ -0.20047377,+ -0.16914974,+ -0.023832094,+ -0.078213185,+ -0.046501648,+ -0.42871934,+ -0.020925742,+ 0.2550486,+ 0.25304645,+ -0.27255133,+ -0.19188388,+ 0.06012921,+ -0.3638754,+ -0.20266968,+ -0.16740593,+ -0.4423469,+ 0.51093686,+ 0.1877504,+ -0.32137805,+ 0.06968788,+ 0.19685698,+ -1.1894734,+ -0.117675,+ 0.10030147,+ 0.018988172,+ -0.25814873,+ 0.017825631,+ -0.3512812,+ 0.097395115,+ 0.0063293907,+ -0.05896667,+ 0.3636816,+ -0.1428634,+ 0.088094786,+ 0.08680307,+ -0.05186225,+ -0.46553314,+ -0.10152859,+ 0.058449987,+ -0.018988172,+ 0.13659859,+ 0.12794411,+ -0.08738434,+ -0.44706166,+ -0.20447807,+ -0.44241148,+ -0.34682477,+ 0.23890221,+ -0.08738434,+ -0.25588822,+ 0.032680325,+ 0.23250823,+ -0.358321,+ 0.31995717,+ -0.017567288,+ -0.07866529,+ 0.14273421,+ -0.2173952,+ -0.023250824,+ -0.12090428,+ -0.13440268,+ -0.078406945,+ -0.25085056,+ 0.23690005,+ 0.26111966,+ -0.12006467,+ -0.15997858,+ 0.41870856,+ -0.34585598,+ -0.86208886,+ -0.124262735,+ -0.08906357,+ -0.08402589,+ -0.28747058,+ 0.58449984,+ 0.3969432,+ -4.2888727,+ 0.019827785,+ -0.23864387,+ 0.10792257,+ 0.37969887,+ -0.39636195,+ 0.23199154,+ 0.09448876,+ 0.268547,+ -0.09403666,+ 0.7605603,+ -0.29967728,+ 0.0970076,+ 0.14066748,+ 0.20731984,+ 0.26247597,+ 0.2673199,+ -0.34114125,+ -0.17825632,+ -0.15513466,+ -0.10669544,+ 0.121291794,+ 0.11735207,+ 0.42587757,+ -0.093003295,+ 0.6195053,+ -0.20266968,+ -0.29702926,+ 0.04914966,+ -0.101786934,+ -0.82385415,+ 0.012658781,+ 0.23954806,+ -0.009752428,+ -0.024607122,+ 0.77806294,+ 0.31795502,+ 0.029903142,+ 0.0006458562,+ -0.041593138,+ 0.23838553,+ 0.24445657,+ 0.36213157,+ -0.09810556,+ -0.23638336,+ -0.34017247,+ -0.3705277,+ 0.13621107,+ 0.34017247,+ -0.06968788,+ 0.10146401,+ -0.14305715,+ 0.30258363,+ 0.1356298,+ -0.27862236,+ -0.14719063,+ 0.37524244,+ 0.11515616,+ -0.11076434,+ 0.45888084,+ -0.10669544,+ 0.1306567,+ -1.0933053,+ 0.22908519,+ 0.16895598,+ -0.59935457,+ -0.6322932,+ 0.37692168,+ -0.024348779,+ -0.21629724,+ 0.22172244,+ 0.013950494,+ -0.20383221,+ -0.28424132,+ -0.080279924,+ -0.07420888,+ 0.42465046,+ -0.322476,+ -0.6134342,+ 0.43059233,+ -0.32131347,+ -0.56428456,+ -0.367363,+ -0.08428423,+ -0.22075365,+ -0.13556522,+ 0.36820263,+ 0.04837463,+ -0.05870833,+ 0.19969873,+ -0.44118437,+ -0.0884823,+ 0.19343393,+ 0.26260513,+ -0.39054924,+ 0.10837467,+ -0.09590965,+ 0.16017234,+ 0.14144251,+ 0.11328318,+ -0.13524228,+ 0.033197008,+ -0.41651267,+ -0.0038751373,+ 0.060839653,+ -0.33984953,+ 0.44028017,+ 0.03125944,+ 0.31821334,+ 0.19517775,+ 0.046178717,+ 0.23593126,+ 0.107405886,+ 0.011173313,+ 0.0880302,+ 0.27629727,+ -0.38170102,+ -0.29677093,+ 0.23838553,+ -0.04824546,+ 0.20886989,+ -0.25362772,+ 0.050635125,+ -0.21326172,+ -0.18923587,+ 0.6598713,+ 0.42161492,+ -0.27791193,+ 0.09997854,+ -0.15384294,+ -0.45875165,+ 0.17276654,+ 0.3642629,+ -0.07033374,+ -0.38047388,+ -0.04378905,+ -0.016792262,+ 0.14428428,+ 0.097072184,+ 0.5116473,+ -0.049408,+ 0.11121644,+ 0.12536068,+ 0.5847582,+ 0.3314534,+ 0.077761084,+ 0.17451034,+ 0.33468267,+ -0.4562974,+ -0.2541444,+ 0.012852538,+ -0.4935633,+ -0.20040917,+ 0.20648022,+ -0.5332835,+ -0.4878152,+ 0.15377836,+ -0.42639425,+ 0.04572662,+ -0.4073415,+ -0.6979122,+ -0.22540382,+ -0.17554371,+ -0.15222831,+ -0.0039397227,+ 0.11728749,+ -0.121550135,+ -0.0907428,+ 0.15022615,+ 0.09668467,+ 0.050635125,+ -0.52346647,+ 0.49595296,+ 0.20002167,+ -0.057610374,+ 0.18839626,+ 0.0480517,+ -0.4806462,+ -0.24723375,+ -0.28010783,+ -0.0010979555,+ 0.2987085,+ 0.23160404,+ -0.023509165,+ -0.052314352,+ 0.23405829,+ -0.48762143,+ 0.10876218,+ -0.2551778,+ 0.67433846,+ -0.45804122,+ -0.085123844,+ 0.5009261,+ 0.013756737,+ -0.2533694,+ 0.23690005,+ 0.14964488,+ -0.08221749,+ 0.038557615,+ 0.31698623,+ -0.18187311,+ -0.060968824,+ 0.15959106,+ 0.3435955,+ 0.23153944,+ -0.23696464,+ -0.05515612,+ -0.48206708,+ -1.0132192,+ 0.5457485,+ -0.02299248,+ 0.21552221,+ 0.08215291,+ -0.17257278,+ 0.07136711,+ -0.40236843,+ -0.45022637,+ 0.254209,+ 0.0018083974,+ 0.18058139,+ -0.002389668,+ 0.08693224,+ 0.16004317,+ -0.16514543,+ 0.45416608,+ -0.019375686,+ -0.20073211,+ -0.21138874,+ 0.22540382,+ 0.26002172,+ -0.5457485,+ -0.0034876235,+ 0.24755669,+ -0.18077515,+ -0.41954818,+ -0.20053835,+ -0.07879446,+ 0.22921437,+ 0.16249742,+ -0.085769705,+ 0.36988184,+ -0.054639433,+ 0.29696468,+ -0.10889135,+ -0.20531769,+ -0.08137788,+ 0.10811633,+ 0.034488723,+ 0.027190546,+ 0.16624339,+ 0.11367069,+ 0.055931147,+ 0.049343415,+ 1.073736,+ -0.77431697,+ 0.15184079,+ 0.17890216,+ 0.12684616,+ 0.19724448,+ -0.13550062,+ 0.010139942,+ 0.1827773,+ -0.1984716,+ -0.16333704,+ 0.32325104,+ -0.10785799,+ 0.056964517,+ 0.035586677,+ -0.16598505,+ 0.18348774,+ 0.021894526,+ 0.13685693,+ 0.14473638,+ 0.004262651,+ 0.3691714,+ -0.16404748,+ -0.44841796,+ 0.16940808,+ 0.05425192,+ -0.10094732,+ -0.10152859,+ -0.09416583,+ -0.11031224,+ -0.7144461,+ 0.3813135,+ -0.121420965,+ -0.10282031,+ -0.19130261,+ -0.22424127,+ -0.33694318,+ -0.022540381,+ -0.018406902,+ -0.19097967,+ -0.034230378,+ -0.23864387,+ -0.25614658,+ 0.31181937,+ 0.25976336,+ 0.12691075,+ 0.25065678,+ -0.05160391,+ -0.19911747,+ -0.18226062,+ -0.19201306,+ -0.21352006,+ -0.13634025,+ 0.07472556,+ 0.15229289,+ -0.2555007,+ 0.049472585,+ -0.03216364,+ 0.2250163,+ 0.075823516,+ -0.1437676,+ 0.16598505,+ 0.31407988,+ 0.13543604,+ 0.06419811,+ -0.42432752,+ -0.5524654,+ -0.40843946,+ 0.15287416,+ 0.16385372,+ 0.05896667,+ 0.24665248,+ 0.1832294,+ 0.40495184,+ 0.24497326,+ 0.16107653,+ -0.1315609,+ 0.032099053,+ -0.25304645,+ 0.26434895,+ 0.3441122,+ -0.20396139,+ -0.1432509,+ -0.09907434,+ 0.33306804,+ -0.14693229,+ -0.073369265,+ -0.0009041987,+ 0.024865463,+ 0.28824562,+ 0.43737382,+ -0.30936512,+ ],+ },+];diff --git a/rust/crates/photos/src/ml/golden_tooling.rs b/rust/crates/photos/src/ml/golden_tooling.rsnew file mode 100644index 0000000000..4e1f7e48f2--- /dev/null+++ b/rust/crates/photos/src/ml/golden_tooling.rs@@ -0,0 +1,309 @@+//! Generation and verification of the committed golden self-test data.+//!+//! Regeneration (`render_golden_data`) runs the production models on the CPU+//! execution provider and is invoked manually via the `generate_goldens`+//! test in the `ml_goldens` test binary (requires the `ml-assets` feature).+//! Verification (`verify_goldens_against_pins`) is metadata-only and runs as+//! a plain unit test in every CI pass.++use std::collections::BTreeMap;+use std::path::Path;++use ort::value::ValueType;++use crate::ml::{clip, golden, golden_data::GOLDEN_ENTRIES, onnx};++pub use crate::ml::golden::GoldenMetric;++/// One fixed seed for all noise inputs. Inputs need not differ across models+/// (each model's input is shaped and consumed independently), and each entry+/// stores its seed, so the device never depends on this constant.+const GOLDEN_NOISE_SEED: u64 = 0x0060_1DE2_5EED_2026;++const GENERATED_FILE_HEADER: &str = "\+//! GENERATED FILE β do not edit by hand.+//!+//! Regenerate with:+//! cargo test -p ente-photos --features ml-assets --test ml_goldens -- --ignored generate_goldens+//!+//! TODO: the pet models are CPU-only and therefore have no golden entries+//! yet; they must get entries here before they are moved off CPU-only+//! execution (see `MlRuntime::new` in runtime.rs).++use crate::ml::golden::{GoldenEntry, GoldenInput, GoldenMetric};++pub(crate) static GOLDEN_ENTRIES: &[GoldenEntry] = &[+";++/// A production model to generate a golden entry for.+pub struct GoldenModelSpec {+ pub model_path: String,+ /// SHA-256 of the model file as pinned in the asset lock; embedded into+ /// the generated entry so that CI can detect a content change without+ /// re-running inference.+ pub sha256: String,+ pub input: GoldenSpecInput,+ /// `CosineDistance` for embedding outputs and a relative-L2 variant for+ /// raw tensor outputs.+ pub metric: GoldenMetric,+}++pub enum GoldenSpecInput {+ /// Deterministic noise seeded from the model file name.+ SeededNoise,+ /// A fixed phrase tokenized with the production CLIP tokenizer.+ ClipText { phrase: String, vocab_path: String },+}++/// Renders the complete contents of `golden_data.rs` for the given models.+pub fn render_golden_data(models: &[GoldenModelSpec]) -> Result<String, String> {+ let mut source = String::from(GENERATED_FILE_HEADER);+ for spec in models {+ source.push_str(&render_entry(spec)?);+ }+ source.push_str("];\n");+ Ok(source)+}++/// A production model as pinned in the asset lock+/// (`infra/ml/test/ml_indexing/assets.json`).+pub struct PinnedModel {+ pub file_name: String,+ pub sha256: String,+}++/// Cheaply verifies that the committed goldens correspond exactly to the+/// pinned production models, by file name and content hash. Returns+/// human-readable failures; empty means consistent.+///+/// Deliberately metadata-only (no model downloads, no inference) so it runs+/// as a plain unit test in every CI pass. This catches the two realistic+/// ways goldens go stale β a model update (new file name) and a content+/// change under an unchanged name β but not numeric drift of the CPU+/// execution provider itself; the wide on-device thresholds absorb that.+pub fn verify_goldens_against_pins(pins: &[PinnedModel]) -> Vec<String> {+ let mut failures = Vec::new();++ let pinned: BTreeMap<&str, &str> = pins+ .iter()+ .map(|pin| (pin.file_name.as_str(), pin.sha256.as_str()))+ .collect();+ let committed: BTreeMap<&str, &str> = GOLDEN_ENTRIES+ .iter()+ .map(|entry| (entry.model_file, entry.model_sha256))+ .collect();++ for (file_name, pinned_sha) in &pinned {+ match committed.get(file_name) {+ None => failures.push(format!(+ "{file_name}: no committed golden entry; regenerate golden_data.rs"+ )),+ Some(committed_sha) if committed_sha != pinned_sha => failures.push(format!(+ "{file_name}: model content changed (pinned sha256 {pinned_sha}, golden \+ generated from {committed_sha}); regenerate golden_data.rs"+ )),+ Some(_) => {}+ }+ }+ for file_name in committed.keys() {+ if !pinned.contains_key(file_name) {+ failures.push(format!(+ "{file_name}: committed golden entry does not correspond to any pinned \+ production model; regenerate golden_data.rs"+ ));+ }+ }++ failures+}++fn render_entry(spec: &GoldenModelSpec) -> Result<String, String> {+ let file_name = model_file_name(&spec.model_path)?;+ let mut session = build_cpu_session(&spec.model_path)?;+ let input_shape = static_input_shape(&mut session, file_name)?;+ let element_count: i64 = input_shape.iter().product();+ let element_count = usize::try_from(element_count)+ .map_err(|_| format!("{file_name}: invalid input shape {input_shape:?}"))?;++ let (input_source, prepared_input) = match &spec.input {+ GoldenSpecInput::SeededNoise => (+ format!("GoldenInput::SeededF32 {{ seed: {GOLDEN_NOISE_SEED:#x} }}"),+ golden::PreparedGoldenInput::F32(golden::seeded_noise(+ GOLDEN_NOISE_SEED,+ element_count,+ )),+ ),+ GoldenSpecInput::ClipText { phrase, vocab_path } => {+ let token_ids = clip::tokenize_clip_text(phrase, vocab_path)+ .map_err(|error| format!("{file_name}: tokenizing golden phrase: {error}"))?;+ if token_ids.len() != element_count {+ return Err(format!(+ "{file_name}: tokenized phrase has {} ids but the model input shape \+ {input_shape:?} expects {element_count}",+ token_ids.len()+ ));+ }+ (+ format!("GoldenInput::I32 {{ data: &{token_ids:?} }}"),+ golden::PreparedGoldenInput::I32(token_ids),+ )+ }+ };++ let output = onnx::run_golden_tensor(&mut session, &input_shape, &prepared_input)+ .map_err(|error| format!("{file_name}: CPU inference failed: {error}"))?;+ if output.is_empty() {+ return Err(format!("{file_name}: model produced an empty output"));+ }+ if !output.iter().copied().all(f32::is_finite) {+ return Err(format!(+ "{file_name}: CPU output contains non-finite values; cannot be used as a golden"+ ));+ }+ let sample = golden::sample_output(&output);++ let mut entry = String::new();+ entry.push_str(" GoldenEntry {\n");+ entry.push_str(&format!(" model_file: \"{file_name}\",\n"));+ entry.push_str(&format!(" model_sha256: \"{}\",\n", spec.sha256));+ entry.push_str(&format!(" input: {input_source},\n"));+ entry.push_str(&format!(" input_shape: &{input_shape:?},\n"));+ entry.push_str(&format!(+ " metric: GoldenMetric::{:?},\n",+ spec.metric+ ));+ entry.push_str(&format!(" output_len: {},\n", output.len()));+ entry.push_str(" expected_sample: &[\n");+ for chunk in sample.chunks(8) {+ let values: Vec<String> = chunk.iter().map(|value| format!("{value:?}")).collect();+ entry.push_str(&format!(" {},\n", values.join(", ")));+ }+ entry.push_str(" ],\n");+ entry.push_str(" },\n");+ Ok(entry)+}++fn model_file_name(model_path: &str) -> Result<&str, String> {+ Path::new(model_path)+ .file_name()+ .and_then(|name| name.to_str())+ .ok_or_else(|| format!("cannot derive model file name from '{model_path}'"))+}++fn build_cpu_session(model_path: &str) -> Result<ort::session::Session, String> {+ onnx::build_session(model_path, onnx::ExecutionMode::CpuOnly, "golden-tooling")+ .map(|(session, _)| session)+ .map_err(|error| format!("building CPU session for '{model_path}': {error}"))+}++/// The first input's static shape. Golden inputs require fully static shapes+/// so that device and generator tensors are identical.+fn static_input_shape(+ session: &mut ort::session::Session,+ file_name: &str,+) -> Result<Vec<i64>, String> {+ let input = session+ .inputs()+ .first()+ .ok_or_else(|| format!("{file_name}: model has no inputs"))?;+ let ValueType::Tensor { shape, .. } = input.dtype() else {+ return Err(format!("{file_name}: first input is not a tensor"));+ };+ if shape.iter().any(|&dim| dim <= 0) {+ return Err(format!(+ "{file_name}: input shape {shape:?} has dynamic dimensions; golden self-tests \+ require static input shapes"+ ));+ }+ Ok(shape.to_vec())+}++#[cfg(test)]+mod tests {+ use super::{PinnedModel, verify_goldens_against_pins};+ use crate::ml::golden_data::GOLDEN_ENTRIES;++ /// Loads the pinned production models from the asset lock. Restricted to+ /// `.onnx` files: other pinned model assets (the CLIP vocabulary) are+ /// model inputs, not models, and get no golden entries.+ fn pinned_production_models() -> Vec<PinnedModel> {+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))+ .join("../../../infra/ml/test/ml_indexing/assets.json");+ let contents = std::fs::read_to_string(&path)+ .unwrap_or_else(|error| panic!("read {}: {error}", path.display()));+ let lock: serde_json::Value = serde_json::from_str(&contents).expect("parse assets.json");+ lock["models"]+ .as_object()+ .expect("assets.json has a models object")+ .values()+ .map(|model| PinnedModel {+ file_name: model["file_name"].as_str().expect("file_name").to_string(),+ sha256: model["sha256"].as_str().expect("sha256").to_string(),+ })+ .filter(|pin| pin.file_name.ends_with(".onnx"))+ .collect()+ }++ /// The CI guard against stale goldens: a model update (new file name) or+ /// a content change under an unchanged name in the asset lock fails this+ /// test until `golden_data.rs` is regenerated (see the `generate_goldens`+ /// test in the ml_goldens test binary).+ #[test]+ fn committed_goldens_are_pinned_to_the_production_models() {+ let pins = pinned_production_models();+ assert!(!pins.is_empty(), "no pinned .onnx models in assets.json");++ let failures = verify_goldens_against_pins(&pins);+ assert!(+ failures.is_empty(),+ "committed golden self-test data is stale ({} finding(s)):\n{}",+ failures.len(),+ failures.join("\n")+ );+ }++ #[test]+ fn reports_missing_content_changed_and_stale_entries() {+ let matching: Vec<PinnedModel> = GOLDEN_ENTRIES+ .iter()+ .map(|entry| PinnedModel {+ file_name: entry.model_file.to_string(),+ sha256: entry.model_sha256.to_string(),+ })+ .collect();+ assert!(verify_goldens_against_pins(&matching).is_empty());++ // A pinned model without an entry, a content change under an+ // unchanged name, and a dropped pin leaving a stale entry.+ let mut pins = matching;+ pins[0].sha256 = "f".repeat(64);+ let stale = pins.pop().unwrap();+ pins.push(PinnedModel {+ file_name: "brand_new_model.onnx".to_string(),+ sha256: "a".repeat(64),+ });++ let failures = verify_goldens_against_pins(&pins);+ assert_eq!(failures.len(), 3, "{failures:?}");+ assert!(+ failures+ .iter()+ .any(|failure| failure.contains("brand_new_model.onnx")+ && failure.contains("no committed golden entry")),+ "{failures:?}"+ );+ assert!(+ failures+ .iter()+ .any(|failure| failure.contains("model content changed")),+ "{failures:?}"+ );+ assert!(+ failures+ .iter()+ .any(|failure| failure.contains(&stale.file_name)+ && failure.contains("does not correspond to any pinned")),+ "{failures:?}"+ );+ }+}diff --git a/rust/crates/photos/src/ml/mod.rs b/rust/crates/photos/src/ml/mod.rsindex 2f319e0fa0..c555236335 100644--- a/rust/crates/photos/src/ml/mod.rs+++ b/rust/crates/photos/src/ml/mod.rs@@ -1,6 +1,10 @@mod clip;pub mod error;+pub mod events;pub mod face;+pub mod golden;+mod golden_data;+pub mod golden_tooling;pub mod indexing;mod onnx;mod pet;diff --git a/rust/crates/photos/src/ml/onnx.rs b/rust/crates/photos/src/ml/onnx.rsindex 74715130b0..6500a3dd64 100644--- a/rust/crates/photos/src/ml/onnx.rs+++ b/rust/crates/photos/src/ml/onnx.rs@@ -24,10 +24,11 @@ use ort::ep::{use std::num::NonZeroUsize;use crate::ml::error::{MlError, MlResult};+use crate::ml::golden;#[cfg(target_os = "android")]use crate::ml::webgpu;-#[cfg(target_os = "android")]-use ort::session::SessionInputValue;+#[cfg(any(target_os = "android", target_os = "ios"))]+use crate::ml::{events, runtime::rt_log};#[cfg(any(target_os = "ios", test))]const COREML_CACHE_SCHEMA: &str = "ort-1_27-mlprogram-all-default-v1";@@ -151,7 +152,7 @@ pub(crate) fn build_session(}let coreml_cache_dir = attempt.coreml_cache_dir.clone();- match build_session_with_providers(model_path, attempt) {+ match build_and_validate_session(model_path, attempt) {Ok(session) => {if let Some(cache_dir) = coreml_cache_dir&& let Err(error) = mark_coreml_cache_complete(&cache_dir)@@ -187,12 +188,45 @@ pub(crate) fn build_session()))}+/// Builds a session for one provider attempt and, for CoreML attempts, runs+/// the golden self-test before the session is trusted. A self-test failure is+/// reported as a session-construction failure, so the caller invalidates the+/// CoreML cache (a corrupt compiled model would otherwise persist) and falls+/// through to the next attempt. WebGPU attempts do not take this path; they+/// are validated inside the crash-canary window.+fn build_and_validate_session(model_path: &str, attempt: ProviderAttempt) -> MlResult<Session> {+ #[cfg(any(target_os = "android", target_os = "ios"))]+ let execution_provider = attempt.execution_provider;++ #[cfg_attr(not(target_os = "ios"), allow(unused_mut))]+ let mut session = match build_session_with_providers(model_path, attempt) {+ Ok(session) => session,+ Err(error) => {+ #[cfg(any(target_os = "android", target_os = "ios"))]+ record_provider_attempt_failure(+ execution_provider,+ model_path,+ "session construction",+ &error,+ );+ return Err(error);+ }+ };++ #[cfg(target_os = "ios")]+ if execution_provider == ExecutionProvider::CoreMl {+ run_session_self_test(model_path, &mut session, "CoreML")?;+ }++ Ok(session)+}+/// Builds the WebGPU session under the durable crash canary. The canary is/// armed before session construction and only disarmed after the session has-/// survived one warm-up inference, so a driver crash anywhere in between is-/// recorded on disk. Soft failures return an error with the canary left armed-/// (the drop keeps the counted attempt), and the caller falls through to the-/// next execution provider.+/// passed the golden self-test, so a driver crash anywhere in between is+/// recorded on disk. Soft failures (including self-test failures) return an+/// error with the canary left armed (the drop keeps the counted attempt), and+/// the caller falls through to the next execution provider.#[cfg(target_os = "android")]fn build_webgpu_session_with_canary(model_path: &str,@@ -201,8 +235,19 @@ fn build_webgpu_session_with_canary() -> MlResult<Session> {// Fail closed: without a durable failure record, a crash during the// attempt would go unnoticed and the crash loop protection would be lost.- let canary = webgpu::arm_canary(model_path, model_namespace)- .map_err(|error| MlError::Ort(format!("failed to arm WebGPU crash canary: {error}")))?;+ let canary = match webgpu::arm_canary(model_path, model_namespace) {+ Ok(canary) => canary,+ Err(error) => {+ let error = MlError::Ort(format!("failed to arm WebGPU crash canary: {error}"));+ record_provider_attempt_failure(+ ExecutionProvider::WebGpu,+ model_path,+ "crash-canary setup",+ &error,+ );+ return Err(error);+ }+ };// The adapter probe touches the Vulkan driver, so it runs inside the// armed canary window: a probe crash is recorded like any other WebGPU// crash.@@ -222,61 +267,187 @@ fn build_webgpu_session_with_canary(// a driver whose probe keeps failing quarantines like one that// keeps crashing, and cannot reset the consecutive-failure// counter of genuine crashes.- return Err(MlError::Ort(- "WebGPU skipped: Vulkan adapter probe failed".to_string(),- ));+ let error = MlError::Ort("WebGPU skipped: Vulkan adapter probe failed".to_string());+ record_provider_attempt_failure(+ ExecutionProvider::WebGpu,+ model_path,+ "adapter probe",+ &error,+ );+ return Err(error);}}- let mut session = build_session_with_providers(model_path, attempt)?;- warmup_session(&mut session)?;+ let mut session = match build_session_with_providers(model_path, attempt) {+ Ok(session) => session,+ Err(error) => {+ record_provider_attempt_failure(+ ExecutionProvider::WebGpu,+ model_path,+ "session construction",+ &error,+ );+ return Err(error);+ }+ };+ run_session_self_test(model_path, &mut session, "WebGPU")?;canary.disarm();Ok(session)}-/// Runs one zeroed inference so that lazy provider work (pipeline creation,-/// first dispatch) happens inside the crash-canary window, and so that the-/// first real inference is not paying the warm-up cost. Output values are-/// irrelevant; only whether the run crashes or errors matters.-#[cfg(target_os = "android")]-fn warmup_session(session: &mut Session) -> MlResult<()> {- let mut input_specs = Vec::new();- for input in session.inputs() {- let ValueType::Tensor { ty, shape, .. } = input.dtype() else {- // Unsupported input kind: skip the warm-up; the canary then only- // covers session construction for this model.- return Ok(());- };- // Our models have static shapes; substitute 1 for any dynamic- // dimension defensively.- let dims: Vec<i64> = shape.iter().map(|&dim| dim.max(1)).collect();- input_specs.push((input.name().to_string(), *ty, dims));- }-- let mut inputs: Vec<(String, SessionInputValue<'_>)> = Vec::new();- for (name, ty, dims) in input_specs {- let element_count = dims.iter().product::<i64>() as usize;- let value: SessionInputValue<'_> = match ty {- TensorElementType::Float32 => {- Tensor::<f32>::from_array((dims, vec![0.0f32; element_count]))?.into()- }- TensorElementType::Float16 => {- Tensor::<half::f16>::from_array((dims, vec![half::f16::ZERO; element_count]))?- .into()- }- TensorElementType::Int32 => {- Tensor::<i32>::from_array((dims, vec![0i32; element_count]))?.into()- }- TensorElementType::Int64 => {- Tensor::<i64>::from_array((dims, vec![0i64; element_count]))?.into()+#[cfg(any(target_os = "android", target_os = "ios"))]+fn record_provider_attempt_failure(+ provider: ExecutionProvider,+ model_path: &str,+ stage: &str,+ error: &MlError,+) {+ if let Some(message) = provider_attempt_failure_message(provider, model_path, stage, error) {+ events::record(events::Severity::Warning, message);+ }+}++#[cfg(any(target_os = "android", target_os = "ios", test))]+fn provider_attempt_failure_message(+ provider: ExecutionProvider,+ model_path: &str,+ stage: &str,+ error: &MlError,+) -> Option<String> {+ let provider_label = match provider {+ ExecutionProvider::CoreMl => "CoreML",+ ExecutionProvider::WebGpu => "WebGPU",+ ExecutionProvider::Xnnpack => "XNNPACK",+ ExecutionProvider::Cpu => return None,+ };+ Some(format!(+ "{provider_label} {stage} failed for '{}': {error}; falling back to the next execution provider",+ model_file_label(model_path)+ ))+}++/// Number of golden inferences a freshly built accelerated session must pass.+/// Two, because known driver defects (for example on newer Adreno GPUs)+/// produce a correct first inference and corrupt output from the second+/// dispatch onwards. The runs double as session warm-up: pipeline creation+/// and first dispatch happen here (on Android inside the crash-canary+/// window), not during the first real inference.+#[cfg(any(target_os = "android", target_os = "ios"))]+const GOLDEN_SELF_TEST_RUNS: usize = 2;++/// Validates a freshly built accelerated session against the model's+/// committed golden output. An error means the session must not be used; the+/// caller falls through to the next execution provider attempt.+#[cfg(any(target_os = "android", target_os = "ios"))]+fn run_session_self_test(+ model_path: &str,+ session: &mut Session,+ provider_label: &str,+) -> MlResult<()> {+ let model_file = model_file_label(model_path);+ let Some(entry) = golden::lookup(model_path) else {+ // Attempts are only constructed for models with a golden entry, so+ // this is a defensive fail-closed path.+ return Err(MlError::Ort(format!(+ "golden self-test entry missing for '{model_file}'"+ )));+ };+ let input = golden::prepare_input(entry).map_err(|reason| {+ MlError::Ort(format!(+ "golden self-test input invalid for '{model_file}': {reason}"+ ))+ })?;++ for run_index in 1..=GOLDEN_SELF_TEST_RUNS {+ let output = match run_golden_tensor(session, entry.input_shape, &input) {+ Ok(output) => output,+ Err(error) => {+ // Surface inference failures too: without this, a provider+ // that cannot even execute the golden input would fall back+ // invisibly (the session-build error is swallowed once the+ // next attempt succeeds).+ events::record(+ events::Severity::Warning,+ format!(+ "{provider_label} golden self-test inference failed for '{model_file}' \+ on run {run_index}: {error}; falling back to the next execution provider"+ ),+ );+ return Err(error);}- _ => return Ok(()),};- inputs.push((name, value));+ match golden::compare_output(entry, &output) {+ Ok(distance) => rt_log(&format!(+ "{provider_label} golden self-test run {run_index} for '{model_file}' passed \+ ({} {distance:.2e})",+ entry.metric.label()+ )),+ Err(reason) => {+ events::record(+ events::Severity::Severe,+ format!(+ "{provider_label} golden self-test failed for '{model_file}' on run \+ {run_index}: {reason}; falling back to the next execution provider"+ ),+ );+ return Err(MlError::Ort(format!(+ "golden self-test failed for '{model_file}' on run {run_index}: {reason}"+ )));+ }+ }}- session.run(inputs)?;Ok(())}+#[cfg(any(target_os = "android", target_os = "ios", test))]+fn model_file_label(model_path: &str) -> &str {+ Path::new(model_path)+ .file_name()+ .and_then(|name| name.to_str())+ .unwrap_or(model_path)+}++/// Runs one golden input through the session and extracts the first output as+/// f32. Shared with the golden generator so device and generator inference+/// are identical by construction.+pub(crate) fn run_golden_tensor(+ session: &mut Session,+ input_shape: &[i64],+ input: &golden::PreparedGoldenInput,+) -> MlResult<Vec<f32>> {+ let shape = input_shape.to_vec();+ let outputs = match input {+ golden::PreparedGoldenInput::F32(data) => {+ if session_expects_f16(session) {+ let input_tensor = Tensor::<half::f16>::from_array((+ shape,+ Vec::<half::f16>::from_f32_slice(data),+ ))?;+ session.run(ort::inputs![input_tensor])?+ } else {+ let input_tensor = Tensor::<f32>::from_array((shape, data.clone()))?;+ session.run(ort::inputs![input_tensor])?+ }+ }+ golden::PreparedGoldenInput::I32(data) => {+ let input_tensor = Tensor::<i32>::from_array((shape, data.clone()))?;+ session.run(ort::inputs![input_tensor])?+ }+ };++ if outputs.len() == 0 {+ return Err(MlError::Ort("missing first output tensor".to_string()));+ }+ let output = &outputs[0];+ if let Ok((_, tensor_data)) = output.try_extract_tensor::<f32>() {+ Ok(tensor_data.to_vec())+ } else {+ let (_, tensor_data) = output.try_extract_tensor::<half::f16>()?;+ let mut data = vec![0.0; tensor_data.len()];+ tensor_data.convert_to_f32_slice(&mut data);+ Ok(data)+ }+}+fn has_protobuf_parse_failure(errors: &[String]) -> bool {errors.iter().any(|error| {error@@ -325,9 +496,11 @@ fn platform_default_attempts(model_path: &str,coreml_cache_namespace: &str,) -> Vec<ProviderAttempt> {- let (coreml_provider, coreml_cache_dir) = coreml_provider(model_path, coreml_cache_namespace);- vec![- ProviderAttempt {+ let mut attempts = Vec::new();+ if golden_entry_required(model_path, "CoreML") {+ let (coreml_provider, coreml_cache_dir) =+ coreml_provider(model_path, coreml_cache_namespace);+ attempts.push(ProviderAttempt {providers: vec![coreml_provider,CPU::default().with_arena_allocator(true).build(),@@ -336,9 +509,10 @@ fn platform_default_attempts(coreml_cache_dir,uses_webgpu: false,execution_provider: ExecutionProvider::CoreMl,- },- ProviderAttempt::cpu_only(),- ]+ });+ }+ attempts.push(ProviderAttempt::cpu_only());+ attempts}#[cfg(target_os = "ios")]@@ -373,7 +547,7 @@ fn platform_default_attempts(_coreml_cache_namespace: &str,) -> Vec<ProviderAttempt> {let mut attempts = Vec::new();- if webgpu::attempt_permitted(model_path) {+ if webgpu::attempt_permitted(model_path) && golden_entry_required(model_path, "WebGPU") {attempts.push(ProviderAttempt {// EP priority follows registration order. Unsupported WebGPU nodes// fall through to XNNPACK and then CPU in the same session.@@ -395,6 +569,24 @@ fn platform_default_attempts(attempts}+/// Accelerated execution providers are only allowed for models with a+/// committed golden self-test entry (fail closed). A miss for a production+/// model means a model update shipped without regenerating `golden_data.rs`.+#[cfg(any(target_os = "android", target_os = "ios"))]+fn golden_entry_required(model_path: &str, provider_label: &str) -> bool {+ if golden::lookup(model_path).is_some() {+ return true;+ }+ events::record(+ events::Severity::Severe,+ format!(+ "no golden self-test entry for '{}'; {provider_label} disabled for this model",+ model_file_label(model_path)+ ),+ );+ false+}+#[cfg(target_os = "android")]fn webgpu_provider() -> ExecutionProviderDispatch {WebGPU::default()@@ -695,10 +887,10 @@ mod tests {use std::{io::Write, path::Path};use super::{- coreml_cache_root, coreml_model_cache_key, ensure_finite_f16, ensure_finite_f32,- has_protobuf_parse_failure, invalidate_coreml_cache, mark_coreml_cache_complete,- prepare_coreml_cache_entry, prune_superseded_coreml_cache_directories,- sanitize_cache_component,+ ExecutionProvider, coreml_cache_root, coreml_model_cache_key, ensure_finite_f16,+ ensure_finite_f32, has_protobuf_parse_failure, invalidate_coreml_cache,+ mark_coreml_cache_complete, prepare_coreml_cache_entry, provider_attempt_failure_message,+ prune_superseded_coreml_cache_directories, sanitize_cache_component,};#[test]@@ -731,6 +923,38 @@ mod tests {)]));}+ #[test]+ fn reports_accelerated_provider_attempt_failures_with_model_context() {+ let error = super::MlError::Ort("provider registration failed".to_string());+ let message = provider_attempt_failure_message(+ ExecutionProvider::CoreMl,+ "/models/face.onnx",+ "session construction",+ &error,+ )+ .unwrap();++ assert!(message.contains("CoreML session construction failed"));+ assert!(message.contains("'face.onnx'"));+ assert!(message.contains("provider registration failed"));+ assert!(message.contains("falling back"));+ }++ #[test]+ fn does_not_report_final_cpu_construction_failure_as_a_fallback() {+ let error = super::MlError::Ort("session construction failed".to_string());++ assert!(+ provider_attempt_failure_message(+ ExecutionProvider::Cpu,+ "/models/face.onnx",+ "session construction",+ &error,+ )+ .is_none()+ );+ }+#[test]fn places_coreml_cache_in_library_caches() {let model = Path::new(diff --git a/rust/crates/photos/src/ml/runtime.rs b/rust/crates/photos/src/ml/runtime.rsindex 730fd8b60d..44fe2f816c 100644--- a/rust/crates/photos/src/ml/runtime.rs+++ b/rust/crates/photos/src/ml/runtime.rs@@ -531,9 +531,13 @@ wherereturn Err(error);}- rt_log(&format!(- "execution provider failed, retrying with the next provider fallback: {error}"- ));+ crate::ml::events::record(+ crate::ml::events::Severity::Warning,+ format!(+ "execution provider failed, retrying with the next provider fallback: \+ {error}"+ ),+ );// Drop provider attributions from the failed attempt; only the// retry that produces the returned value should count.runtime_view.reset_used_providers();diff --git a/rust/crates/photos/tests/ml_goldens.rs b/rust/crates/photos/tests/ml_goldens.rsnew file mode 100644index 0000000000..359300351a--- /dev/null+++ b/rust/crates/photos/tests/ml_goldens.rs@@ -0,0 +1,90 @@+//! Manual (re)generation of the committed golden self-test data in+//! `src/ml/golden_data.rs`.+//!+//! `generate_goldens` is `#[ignore]`d; run it after a model update (or an+//! asset-lock change) to regenerate the file:+//! cargo test -p ente-photos --features ml-assets --test ml_goldens -- --ignored generate_goldens+//!+//! CI does not run inference to validate the committed goldens; instead the+//! cheap `committed_goldens_are_pinned_to_the_production_models` unit test in+//! `golden_tooling` checks that every pinned production model in the asset+//! lock has a committed entry generated from the same content hash.++// The support module is shared with the ml_indexing test binary; parts unused+// by this binary are fine.+#[allow(dead_code)]+mod support;++use anyhow::{Context, bail};+use ente_photos::ml::golden_tooling::{+ GoldenMetric, GoldenModelSpec, GoldenSpecInput, render_golden_data,+};+use support::ml_indexing::{GoldenTestAssets, run_with_large_stack};++/// Fixed phrase for the CLIP text golden; tokenized with the production+/// tokenizer at generation time and committed as token ids.+const CLIP_TEXT_GOLDEN_PHRASE: &str = "a photo of a dog playing on a sunny beach";++fn production_model_specs(assets: &GoldenTestAssets) -> Vec<GoldenModelSpec> {+ // TODO: add the pet models here (and thereby to golden_data.rs) before+ // they are moved off CPU-only execution.+ vec![+ GoldenModelSpec {+ model_path: assets.face_detection.path.to_string_lossy().into_owned(),+ sha256: assets.face_detection.sha256.clone(),+ input: GoldenSpecInput::SeededNoise,+ // Validate confidence independently so large box and landmark+ // coordinates cannot hide score corruption.+ metric: GoldenMetric::DetectorRelativeL2 {+ row_len: 16,+ confidence_offset: 4,+ },+ },+ GoldenModelSpec {+ model_path: assets.face_embedding.path.to_string_lossy().into_owned(),+ sha256: assets.face_embedding.sha256.clone(),+ input: GoldenSpecInput::SeededNoise,+ metric: GoldenMetric::CosineDistance,+ },+ GoldenModelSpec {+ model_path: assets.clip_image.path.to_string_lossy().into_owned(),+ sha256: assets.clip_image.sha256.clone(),+ input: GoldenSpecInput::SeededNoise,+ metric: GoldenMetric::CosineDistance,+ },+ GoldenModelSpec {+ model_path: assets.clip_text.path.to_string_lossy().into_owned(),+ sha256: assets.clip_text.sha256.clone(),+ input: GoldenSpecInput::ClipText {+ phrase: CLIP_TEXT_GOLDEN_PHRASE.to_string(),+ vocab_path: assets.clip_text_vocab.to_string_lossy().into_owned(),+ },+ metric: GoldenMetric::CosineDistance,+ },+ ]+}++#[test]+#[ignore = "regenerates src/ml/golden_data.rs from the production models"]+fn generate_goldens() {+ run_with_large_stack("generate_goldens", || {+ let assets = GoldenTestAssets::load()?;+ let specs = production_model_specs(&assets);+ let source = render_golden_data(&specs)+ .map_err(|error| anyhow::anyhow!("generating goldens: {error}"))?;+ let path = GoldenTestAssets::golden_data_path()?;+ std::fs::write(&path, source).with_context(|| format!("write {}", path.display()))?;+ // Normalize to the repository's rustfmt style so the generated file+ // passes format checks without a manual step.+ let rustfmt = std::process::Command::new("rustfmt")+ .args(["--edition", "2024"])+ .arg(&path)+ .status()+ .with_context(|| format!("run rustfmt on {}", path.display()))?;+ if !rustfmt.success() {+ bail!("rustfmt failed on {}", path.display());+ }+ println!("wrote {}", path.display());+ Ok(())+ });+}diff --git a/rust/crates/photos/tests/support/ml_indexing.rs b/rust/crates/photos/tests/support/ml_indexing.rsindex eef327b2c3..e1b7b61301 100644--- a/rust/crates/photos/tests/support/ml_indexing.rs+++ b/rust/crates/photos/tests/support/ml_indexing.rs@@ -362,6 +362,69 @@ impl MlIndexingTestContext {}}+/// A downloaded production model together with its content hash as pinned in+/// the asset lock, for embedding into generated golden entries.+#[allow(dead_code)]+pub(crate) struct GoldenModelAsset {+ pub(crate) path: PathBuf,+ pub(crate) sha256: String,+}++/// Downloaded production model assets for the golden self-test tooling, with+/// ONNX Runtime already initialized. Used by the ml_goldens test binary only.+#[allow(dead_code)]+pub(crate) struct GoldenTestAssets {+ pub(crate) face_detection: GoldenModelAsset,+ pub(crate) face_embedding: GoldenModelAsset,+ pub(crate) clip_image: GoldenModelAsset,+ pub(crate) clip_text: GoldenModelAsset,+ pub(crate) clip_text_vocab: PathBuf,+}++#[allow(dead_code)]+impl GoldenTestAssets {+ pub(crate) fn load() -> Result<Self> {+ let repo_root = repo_root()?;+ let asset_lock = load_asset_lock(&repo_root)?;+ let cache_dir = cache_dir(&repo_root);+ let client = Client::builder()+ .user_agent("ente-rust-ml-goldens-test")+ .build()+ .context("build HTTP client")?;++ let onnx_runtime_library =+ resolve_onnx_runtime_library(&client, &cache_dir, &asset_lock.onnx_runtime)?;+ let _ = ort::init_from(&onnx_runtime_library)+ .context("load ONNX Runtime dynamic library")?+ .commit();++ let golden_model = |label: &str, model: &ModelAsset| -> Result<GoldenModelAsset> {+ Ok(GoldenModelAsset {+ path: resolve_model_asset(&client, &cache_dir, label, model)?,+ sha256: model.sha256.clone(),+ })+ };++ let models = &asset_lock.models;+ Ok(Self {+ face_detection: golden_model("face-detection", &models.face_detection)?,+ face_embedding: golden_model("face-embedding", &models.face_embedding)?,+ clip_image: golden_model("clip-image", &models.clip_image)?,+ clip_text: golden_model("clip-text", &models.clip_text)?,+ clip_text_vocab: resolve_model_asset(+ &client,+ &cache_dir,+ "clip-text-vocab",+ &models.clip_text_vocab,+ )?,+ })+ }++ pub(crate) fn golden_data_path() -> Result<PathBuf> {+ Ok(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/ml/golden_data.rs"))+ }+}+pub(crate) struct PreparedMlRuntime {model_paths: ModelPaths,}@@ -414,6 +477,11 @@ struct ModelAssets {face_detection: ModelAsset,face_embedding: ModelAsset,clip_image: ModelAsset,+ // Used by the ml_goldens test binary only.+ #[allow(dead_code)]+ clip_text: ModelAsset,+ #[allow(dead_code)]+ clip_text_vocab: ModelAsset,}#[derive(Debug, Deserialize)]