style: cargo fmt --workspace (whitespace/wrapping only, no semantic change)
Whole-workspace rustfmt pass picked up while iterating on Mamba GPU backward work. Verified formatting-only via diff sampling; no logic changed. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -103,10 +103,7 @@ impl WindowedAcceptanceTracker {
|
||||
if self.buffer.is_empty() {
|
||||
return 0.0;
|
||||
}
|
||||
self.buffer
|
||||
.iter()
|
||||
.copied()
|
||||
.fold(f32::INFINITY, f32::min)
|
||||
self.buffer.iter().copied().fold(f32::INFINITY, f32::min)
|
||||
}
|
||||
|
||||
/// Maximum value in the current window, or `0.0` if empty.
|
||||
@@ -266,8 +263,7 @@ impl PerformanceMetrics {
|
||||
};
|
||||
|
||||
// Push per-step acceptance rate into the sliding window.
|
||||
let step_rate =
|
||||
step_result.accepted_tokens as f32 / step_result.draft_tokens.max(1) as f32;
|
||||
let step_rate = step_result.accepted_tokens as f32 / step_result.draft_tokens.max(1) as f32;
|
||||
self.windowed.push(step_rate);
|
||||
|
||||
// Estimate speedup ratio
|
||||
@@ -338,10 +334,7 @@ mod tests {
|
||||
assert!(tracker.is_full());
|
||||
// Sum should be 0.2 + 0.3 + 0.4 = 0.9 → mean ≈ 0.3
|
||||
let rate = tracker.windowed_rate();
|
||||
assert!(
|
||||
(rate - 0.3).abs() < 1e-5,
|
||||
"expected ~0.3, got {rate}"
|
||||
);
|
||||
assert!((rate - 0.3).abs() < 1e-5, "expected ~0.3, got {rate}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -438,8 +431,16 @@ mod tests {
|
||||
tracker.push(0.3);
|
||||
tracker.push(0.7);
|
||||
tracker.push(0.9);
|
||||
assert!((tracker.min() - 0.3).abs() < 1e-5, "min got {}", tracker.min());
|
||||
assert!((tracker.max() - 0.9).abs() < 1e-5, "max got {}", tracker.max());
|
||||
assert!(
|
||||
(tracker.min() - 0.3).abs() < 1e-5,
|
||||
"min got {}",
|
||||
tracker.min()
|
||||
);
|
||||
assert!(
|
||||
(tracker.max() - 0.9).abs() < 1e-5,
|
||||
"max got {}",
|
||||
tracker.max()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -455,7 +456,7 @@ mod tests {
|
||||
fn test_clamp_out_of_range() {
|
||||
let mut tracker = WindowedAcceptanceTracker::new(5);
|
||||
tracker.push(-0.5); // clamped to 0.0
|
||||
tracker.push(1.5); // clamped to 1.0
|
||||
tracker.push(1.5); // clamped to 1.0
|
||||
assert!((tracker.windowed_rate() - 0.5).abs() < 1e-5);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user