MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / slice_codes_bqt

Function slice_codes_bqt

src/models/heartmula/codec.cpp:1465–1483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1463 }
1464}
1465
1466std::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);

Callers 1

detokenize_codesMethod · 0.85

Calls 3

copyFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected