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:
@@ -257,7 +257,11 @@ impl SparseAttentionLayer {
|
||||
pub fn new(config: SparseAttentionConfig, head_dim: usize) -> Self {
|
||||
let scale = 1.0 / (head_dim as f32).sqrt();
|
||||
let mask = SparseAttentionMask::new(config.clone());
|
||||
Self { config, mask, scale }
|
||||
Self {
|
||||
config,
|
||||
mask,
|
||||
scale,
|
||||
}
|
||||
}
|
||||
|
||||
/// CPU reference forward pass.
|
||||
@@ -581,7 +585,10 @@ mod tests {
|
||||
for i in 0..16 {
|
||||
let cnt = mask.attention_count(i);
|
||||
assert!(cnt > 0, "token {i} must attend to at least one position");
|
||||
assert!(cnt <= 16, "token {i} cannot attend to more than seq_len positions");
|
||||
assert!(
|
||||
cnt <= 16,
|
||||
"token {i} cannot attend to more than seq_len positions"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +607,10 @@ mod tests {
|
||||
};
|
||||
let mask = SparseAttentionMask::new_with_seed(config, 0);
|
||||
for i in 0..10 {
|
||||
assert!(mask.mask[i][i], "self-attention must always be set (window_radius=0)");
|
||||
assert!(
|
||||
mask.mask[i][i],
|
||||
"self-attention must always be set (window_radius=0)"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user