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

Function load_residual_unit

src/models/heartmula/codec.cpp:393–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391 const int64_t first_channels = config.init_channel * pow2_i64(config.upsample_factors.size());
392 weights.input_conv = load_weight_norm_conv1d(
393 store,
394 source,
395 "scalar_model.decoder.0",
396 storage_type,
397 first_channels,
398 config.latent_hidden_dim,
399 config.delay_kernel_size);
400 weights.blocks.reserve(config.upsample_factors.size());
401 int64_t in_channels = first_channels;
402 for (size_t block_index = 0; block_index < config.upsample_factors.size(); ++block_index) {
403 const int64_t out_channels = in_channels / 2;
404 const std::string prefix = "scalar_model.decoder." + std::to_string(block_index + 1);
405 HeartCodecDecoderBlockWeights block;
406 block.up_conv = load_weight_norm_conv_transpose1d(
407 store,
408 source,
409 prefix + ".up_conv.layer",
410 storage_type,
411 in_channels,
412 out_channels,
413 config.upsample_kernel_sizes[block_index]);
414 block.residual_units.reserve(5);
415 for (int64_t residual = 0; residual < 5; ++residual) {
416 block.residual_units.push_back(load_residual_unit(
417 store,
418 source,
419 prefix + ".convs." + std::to_string(residual),
420 storage_type,
421 out_channels,
422 config.res_kernel_size));
423 }

Callers 2

load_weightsFunction · 0.50

Calls 2

load_preluFunction · 0.85
load_weight_norm_conv1dFunction · 0.70

Tested by

no test coverage detected