| 1272 | if (assets_ == nullptr) { |
| 1273 | throw std::runtime_error("HeartCodec weights runtime requires assets"); |
| 1274 | } |
| 1275 | if (execution_context_ == nullptr || execution_context_->backend() == nullptr) { |
| 1276 | throw std::runtime_error("HeartCodec weights runtime requires initialized execution context"); |
| 1277 | } |
| 1278 | if (execution_context_->config().threads <= 0) { |
| 1279 | throw std::runtime_error("HeartCodec weights runtime requires positive thread count"); |
| 1280 | } |
| 1281 | weights_ = std::make_shared<HeartCodecWeights>( |
| 1282 | load_heartcodec_weights( |
| 1283 | *assets_, |
| 1284 | execution_context_->backend(), |
| 1285 | execution_context_->backend_type(), |
| 1286 | weight_context_bytes, |
| 1287 | weight_storage_type)); |
| 1288 | assets_->codec_weights->release_storage(); |
| 1289 | } |
| 1290 | |
| 1291 | HeartCodecWeightsRuntime::~HeartCodecWeightsRuntime() { |
| 1292 | scalar_decoder_graph_.reset(); |
| 1293 | conditioning_graph_.reset(); |
| 1294 | flow_estimator_graph_.reset(); |
| 1295 | weights_.reset(); |
| 1296 | } |
no test coverage detected