| 231 | } |
| 232 | |
| 233 | std::vector<int64_t> sparse_mel_ends(const AudioTensor & filterbank) { |
| 234 | const int64_t n_mels = filterbank.shape[0]; |
| 235 | const int64_t freq_bins = filterbank.shape[1]; |
| 236 | std::vector<int64_t> ends(static_cast<size_t>(n_mels), freq_bins); |
| 237 | for (int64_t mel = 0; mel < n_mels; ++mel) { |
| 238 | int64_t end = freq_bins; |
| 239 | while (end > 0 && filterbank.values[static_cast<size_t>(mel * freq_bins + end - 1)] == 0.0f) { |
| 240 | --end; |
| 241 | } |
| 242 | ends[static_cast<size_t>(mel)] = end; |
| 243 | } |
| 244 | return ends; |
| 245 | } |
| 246 | |
| 247 | FeatureNormalizeOutput normalize_batch_impl( |
| 248 | const std::vector<float> & features, |