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

Function final_layer_norm_modulation

src/models/heartmula/codec.cpp:876–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

874 auto timestep_mod = modules::LinearModule({estimator_dim, 6 * estimator_dim, true, GGML_PREC_F32})
875 .build(ctx, modules::SiluModule{}.build(ctx, embedded_timestep), weights.adaln_single.linear);
876 for (size_t index = 0; index < weights.transformer_blocks.size(); ++index) {
877 const auto & block = weights.transformer_blocks[index];
878 s = flow_transformer_block(ctx, s, timestep_mod, positions, block, config.num_attention_heads, config.attention_head_dim);
879 }
880 s = final_layer_norm_modulation(ctx, s, embedded_timestep, weights.scale_shift_table, estimator_dim);
881 ggml_tensor * first_stage_state = s.tensor;
882
883 auto x = modules::ConcatModule({2}).build(ctx, hidden_states, s);
884 x = project_layer(ctx, x, weights.connection_proj, config.in_channels + estimator_dim, estimator_dim_2);
885 auto embedded_timestep_2 = adaln_embedding(ctx, timesteps, freqs, weights.adaln_single_2, estimator_dim_2);
886 auto timestep_mod_2 = modules::LinearModule({estimator_dim_2, 6 * estimator_dim_2, true, GGML_PREC_F32})
887 .build(ctx, modules::SiluModule{}.build(ctx, embedded_timestep_2), weights.adaln_single_2.linear);
888 for (size_t index = 0; index < weights.transformer_blocks_2.size(); ++index) {
889 const auto & block = weights.transformer_blocks_2[index];
890 x = flow_transformer_block(ctx, x, timestep_mod_2, positions, block, config.num_attention_heads, config.attention_head_dim * 2);
891 }
892 x = final_layer_norm_modulation(ctx, x, embedded_timestep_2, weights.scale_shift_table_2, estimator_dim_2);
893 return {project_layer(ctx, x, weights.proj_out, estimator_dim_2, config.out_channels), first_stage_state};
894}
895
896} // namespace
897
898class HeartCodecFlowEstimatorGraph {
899public:

Callers 1

flow_estimatorFunction · 0.85

Calls 7

reshape_tensorFunction · 0.85
RepeatModuleClass · 0.85
SliceModuleClass · 0.85
LayerNormModuleClass · 0.85
expand_batch_tokenFunction · 0.70
add_oneFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected