| 849 | } |
| 850 | |
| 851 | DeepFilterNet2GraphOutput run(const Tensor4 & feat_erb, const Tensor4 & feat_spec) const { |
| 852 | ggml_backend_tensor_set(feat_erb_, feat_erb.v.data(), 0, feat_erb.v.size() * sizeof(float)); |
| 853 | ggml_backend_tensor_set(feat_spec_, feat_spec.v.data(), 0, feat_spec.v.size() * sizeof(float)); |
| 854 | const auto status = core::compute_backend_graph(backend_, graph_, plan_, "DeepFilterNet2 forward"); |
| 855 | ggml_backend_synchronize(backend_); |
| 856 | if (status != GGML_STATUS_SUCCESS) { |
| 857 | throw std::runtime_error("DeepFilterNet2 forward graph compute failed"); |
| 858 | } |
| 859 | return { |
| 860 | read_tensor(mask_, mask_shape_), |
| 861 | read_tensor(coefs_, coefs_shape_), |
| 862 | read_tensor(lsnr_, lsnr_shape_), |
| 863 | read_tensor(alpha_, alpha_shape_), |
| 864 | }; |
| 865 | } |
| 866 | |
| 867 | private: |
| 868 | DeepFilterNet2Tensor read_tensor(ggml_tensor * tensor, const core::TensorShape & shape) const { |
no test coverage detected