| 1368 | } |
| 1369 | |
| 1370 | HeartCodecConditioning HeartCodecWeightsRuntime::build_conditioning( |
| 1371 | const std::vector<int32_t> & codes, |
| 1372 | int64_t batch_size, |
| 1373 | int64_t code_frames) const { |
| 1374 | if (batch_size <= 0 || code_frames <= 0) { |
| 1375 | throw std::runtime_error("HeartCodec conditioning request shape is invalid"); |
| 1376 | } |
| 1377 | if (scalar_decoder_graph_ != nullptr) { |
| 1378 | scalar_decoder_graph_->release_workspace(); |
| 1379 | } |
| 1380 | if (conditioning_graph_ == nullptr || !conditioning_graph_->matches(*this, batch_size, code_frames)) { |
| 1381 | conditioning_graph_ = std::make_unique<HeartCodecConditioningGraph>(*this, batch_size, code_frames); |
| 1382 | } |
| 1383 | return conditioning_graph_->run(codes); |
| 1384 | } |
| 1385 | |
| 1386 | void HeartCodecWeightsRuntime::clear_graph_cache() const { |
| 1387 | flow_estimator_graph_.reset(); |
| 1388 | conditioning_graph_.reset(); |
no test coverage detected