| 590 | } |
| 591 | |
| 592 | std::vector<float> run(const std::vector<float> & mel, int64_t frames) { |
| 593 | if (frames != capacity_frames_) { |
| 594 | throw std::runtime_error("HiFT F0 graph frame mismatch"); |
| 595 | } |
| 596 | ggml_backend_tensor_set(input_, mel.data(), 0, mel.size() * sizeof(float)); |
| 597 | if (engine::core::compute_backend_graph(weights_->execution_context->backend(), graph_) != GGML_STATUS_SUCCESS) { |
| 598 | throw std::runtime_error("ggml_backend_graph_compute failed for HiFT F0 predictor"); |
| 599 | } |
| 600 | auto raw = core::read_tensor_f32(output_); |
| 601 | std::vector<float> f0(static_cast<size_t>(frames), 0.0F); |
| 602 | for (int64_t t = 0; t < frames; ++t) { |
| 603 | f0[static_cast<size_t>(t)] = raw[static_cast<size_t>(t)]; |
| 604 | } |
| 605 | return f0; |
| 606 | } |
| 607 | |
| 608 | private: |
| 609 | const HiftVocoderWeights * weights_ = nullptr; |
no test coverage detected