| 1463 | } |
| 1464 | } |
| 1465 | |
| 1466 | std::vector<float> make_flow_input( |
| 1467 | const std::vector<float> & x, |
| 1468 | const std::vector<float> & incontext, |
| 1469 | const std::vector<float> & mu, |
| 1470 | int64_t batch, |
| 1471 | int64_t frames, |
| 1472 | int64_t latent_dim, |
| 1473 | int64_t cond_dim, |
| 1474 | bool conditional_mu) { |
| 1475 | if (static_cast<int64_t>(x.size()) != batch * frames * latent_dim || |
| 1476 | static_cast<int64_t>(incontext.size()) != batch * frames * latent_dim || |
| 1477 | static_cast<int64_t>(mu.size()) != batch * frames * cond_dim) { |
| 1478 | throw std::runtime_error("HeartCodec flow input shape mismatch"); |
| 1479 | } |
| 1480 | std::vector<float> out(static_cast<size_t>(batch * frames * (2 * latent_dim + cond_dim)), 0.0F); |
| 1481 | const int64_t channels = 2 * latent_dim + cond_dim; |
| 1482 | for (int64_t b = 0; b < batch; ++b) { |
| 1483 | for (int64_t t = 0; t < frames; ++t) { |
| 1484 | const size_t x_base = static_cast<size_t>((b * frames + t) * latent_dim); |
| 1485 | const size_t mu_base = static_cast<size_t>((b * frames + t) * cond_dim); |
| 1486 | const size_t dst = static_cast<size_t>((b * frames + t) * channels); |
no test coverage detected