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:
osobh
2026-08-10 07:09:36 -07:00
co-authored by Claude Sonnet 5
parent ad6405663f
commit 4aaa36a57a
305 changed files with 25537 additions and 18337 deletions
+17 -7
View File
@@ -3,9 +3,9 @@
//! This module provides utilities for converting between linear and mel-scale
//! spectrograms, which are commonly used in speech processing and TTS systems.
use crate::error::{Result, TtsError};
use rtx_tensor::{Device, Result as TensorResult, Tensor, TensorError};
use serde::{Deserialize, Serialize};
use crate::error::{Result, TtsError};
/// Configuration for mel spectrogram computation
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -49,19 +49,27 @@ impl MelConfig {
/// Validate configuration parameters
pub fn validate(&self) -> Result<()> {
if self.sample_rate == 0 {
return Err(TtsError::InvalidConfig("Sample rate must be > 0".to_string()));
return Err(TtsError::InvalidConfig(
"Sample rate must be > 0".to_string(),
));
}
if self.n_fft == 0 {
return Err(TtsError::InvalidConfig("FFT size must be > 0".to_string()));
}
if self.hop_length == 0 {
return Err(TtsError::InvalidConfig("Hop length must be > 0".to_string()));
return Err(TtsError::InvalidConfig(
"Hop length must be > 0".to_string(),
));
}
if self.win_length == 0 || self.win_length > self.n_fft {
return Err(TtsError::InvalidConfig("Window length must be > 0 and <= n_fft".to_string()));
return Err(TtsError::InvalidConfig(
"Window length must be > 0 and <= n_fft".to_string(),
));
}
if self.n_mels == 0 {
return Err(TtsError::InvalidConfig("Number of mels must be > 0".to_string()));
return Err(TtsError::InvalidConfig(
"Number of mels must be > 0".to_string(),
));
}
if self.f_min < 0.0 {
return Err(TtsError::InvalidConfig("f_min must be >= 0".to_string()));
@@ -182,7 +190,9 @@ impl MelSpectrogram {
// Compute pseudo-inverse: (A^T A)^-1 A^T
// For efficiency, we use a simple transpose approximation
// This is not perfect but works well for vocoding
let mel_fb_t = self.mel_filterbank.transpose(0, 1)
let mel_fb_t = self
.mel_filterbank
.transpose(0, 1)
.map_err(|e| TtsError::TensorError(e.to_string()))?;
// linear_spec ≈ mel_fb^T @ mel_spec
@@ -200,7 +210,7 @@ impl MelSpectrogram {
/// # Returns
/// Mel spectrogram [n_mels, time_frames]
pub fn audio_to_mel(&self, audio: &Tensor) -> Result<Tensor> {
use rtx_tensor::signal::{mel_spectrogram, MelOptions, WindowType};
use rtx_tensor::signal::{MelOptions, WindowType, mel_spectrogram};
let options = MelOptions {
sample_rate: self.config.sample_rate as f32,